TCP/IP Implementation General Questions

Posted by user2971023 on Stack Overflow See other posts from Stack Overflow or by user2971023
Published on 2013-11-09T02:38:54Z Indexed on 2013/11/09 3:54 UTC
Read the original article Hit count: 129

Filed under:
|
|
|
|

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?

© Stack Overflow or respective owner

Related posts about c#

Related posts about sockets