Open comments for this post
Devlog 4:
HELLLOOO omg ive been out so long. These past couple of days ive been thinking so long about protocol design for the actual file transfer that i said im working on. GOsh it was such a long journey. 5 rejected ideas and endless staring at the whiteboard. Nevertheless, ive managed to build a file negotiation system (so that the other device can accept/reject the incoming file) that can then also transfer files later on. The reason it was so complex because well, file negotiation is completely different from normal message packets. I need to measure the file size (that can be 64-bit worth in size….which is just BIG), the file name size (which was the big issue for me) and bundle them together and send over the wire. Earlier i was thinking to make completely different packet type for such tasks, but that was seriously wrong idea as i would end up with endless conditional loops, and it looks awful. Instead what im doing is im serializing all that info and shoving it inside the body of the main packet. Then build a seperate deserializer for the file metadata so it could extract data and show it to the user. You could say i could’ve just used the existing messaging infra to transfer the info…after all they’re just strings, right? Well, true they’re just strings, but we’re handling them completely differently. For instance, we’re building a separate architecture for this so that the messaging thing remains different from the file thing. They both dont have any business to be together. That’s called modularity. And besides, i will be transferring files…i certainly couldnt do that using messaging technique and was bound to make a different protocol. SO here i am. Im so sleep deprived rn. so good night
Open comments for this post
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!
Open comments for this post
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!
Open comments for this post
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.
Open comments for this post
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)