Quote:
Originally Posted by mcrabben7
TCP is a Streaming Protocol, please go read what that means. It doesn't matter if you use Sync or Async sockets, the TCP packets will come at you in order, but they will have no packet breaks. In essence, you will get one giant, never-ending stream of bytes. This is why you have to read the len from the packet and only read len bytes. Otherwise, you will never know where the start and end of a packet are.
I did socket programming in C++ using TCP, so I'm not talking up a storm without experience.
|
Sorry but i cannot agree with that
its depends how you are using the sockets
In example
in C if you are using
int recv(int sockfd, void *buf, int len, unsigned int flags);
return value is how much data (bytes ) actualy comes to that socket and now here is the "Solved" question recv recived 26 bytes of data and in this 26 bytes we have 2 game packets.