TCP/IP Implementation General Questions
- by user2971023
I've implemented the concepts shown here; http://wiki.unity3d.com/index.php/Simple_TCP/IP_Client_-_Server outside of unity and it works. (though i had to create the TCPIPServerApp from scratch as i could not find the base project anywhere).
I have some general questions on how to use tcp/ip properly however. I've done some research on tcp/ip itself but I'm still a little confused.
It seems like using the method above doesn't guarantee that I'll see the message (res). It just checks on every update to see if there is a different message in res. What if multiple messages are sent and the program lags or something, will i miss the earlier packet(s)? Should i instead do an array so it stores the last X messages?
How do i know the data was received? Do I need to add a message id and build in my own ack into the data?
Should i check to see if the port is in use before setting up a connection?
Sorry for all the questions. This is all new to me but I enjoy this very much!
... Below already answered By Anton, Thanks
It sounds like tcp uses its own packet numbering to ensure the packets end up in the right order on the other side. What if a packet is missed, are the subsequent packets thrown away? Or is this numbering and packet ordering, only for handling data that is broken out into multiple packets?
TCP will automatically break the data into multiple packets if necessary right?