Devlog 3:
Hey y’all new day new ambitions, at least i dont have them. Jokes apart, today I implemented something which bridges the gap more towards the actual file transfer. I added the binary to ASCII and vice versa conversion for receiving and sending packets respectively. Earlier to keep things simple, I was just sending std::string packets, but files cannot be sent that way. Thats one of the foundational stepping stone for this. Apart from this, I also improved the readability for the enum values for payload_type (for which I was kinda responsible in the first place lol). I used to start the numbers with 0…examples: 010, 002, etc. They all represent octal values in C++. I didnt wanna get into that mess so I just removed it. I also added a necessary check to see if the receiving packet contains text or a file chunk (tho only text for now since Ive not implemented the file transfer yet). Im yet to do that flag for the sending as well, but not before I add file handling.
Nowadays, I’m just changing the architecture rather than functionality and features. Since I made this project for file transfer than chatting, I think I’d keep both of them, because I have one of them ready, and why not?
Thanks have a great day!
Devlog 2:
Added the SendPacket() function to both client and server module. Im essentially making custom functions so I get better flexibility with managing my packets rather to directly use unix functions to do what I want. I really needed the pointer arithmetic check (this is common for the ReceivePacket() as well) because well, TCP guarantees all the bytes will be sent, but not the time it will take to do so. That is why we have to keep looping through our buffer size to get an idea of how many bytes we received and how many are remaining. Yep, its subtle but absolutely important for file transfers. You dont want receiving incomplete and corrupt files!
Devlog 1:
soooooooooooo i finally understood what einstein type shi brain I used before my vacation. Right now my main goal was to not add new features, but to improve the readability of the code. For this, I made a new function, ReceivePacket(), that does nothing but uses TCP streams to receive packets. Earlier I repeated its function for like 4 times, so I made a dedicated function in my API so I could easily use it and reduces lines of code. Enough tech talk, im still recovering from the vacation mode haha.
As i started this project wayyy earlier than i logged into hacktime, I have the chatting thing ready. Though its not much, its better than nothing. Atleast the foundation is set up. I was going to add the file transfer stuff soon, but I went for a vacation for like a week and I forgot much of the stuff (my memory is like a gold fish). But the one thing that I did learn was that: ALWAYS DOCUMENT AND ADD COMMENTS TO YOUR CODE. That way reading it after an eternity is much more sane. Anyways, what I did really was read the code. Spent two days understanding what my sleep-deprived brain at 2AM thought. Wish me luck. b-bye! (also idk what to upload in the screenshot when i said i did nothing meaningful)