Documentation on TCP buffers

Started by
13 comments, last by _Kami_ 15 years, 10 months ago
You can also check the remote application sending the data for an error. Perhaps it will disregard some error, like that the send buffer is full, and still remove the data it tried to send from it's application buffer.
Advertisement
The data makes it across the network ok - I can see that from Wireshark sniffing the packets. Unfortunately it appears (though is not obvious, due to obfuscated code) that the last 2 recv() calls miss out about 5K of that data, which would come after the first call and before the second. Strange.
i suppose if the recv buffer is zero, the TCP will receive nothing. That because the ack segment will notify its window size is zero, and the remote machine will not send anything until the window size is > zero .
Hmm, at the moment it's looking like my bizarre missing data problem was caused by the firewall losing it. Since turning that off, the symptoms have gone away.
Does the machine in question have NetLimiter installed by any chance?
No, it was just ZoneAlarm.
Quote:I'd still be interested in hearing if anybody knows for definite what happens on the receiving side when the receive buffer is full though


- Nothing fancy happens on the receiving side. The kernel is full and is not accepting the data and it will inform the clients.

- The client needs to implement error checking for this..

len = strlen(msg);
bytes_sent = send(sockfd, msg, len, 0);

if (bytes_sent == -1) do error handling
if (bytes_sent != len) store what you managed to send and try to resend the rest at a later time!

send will fire off as much of the data as it can, and trust you to send the rest later. If the value returned by send() doesn't match the value in len, it's up to you to send the rest of the string


So in short, you dont need to handle this on the server. As long as it reads every now and then it should be fine.

tcp packets are guaranteed to arrive in order.
www.ageofconan.com

This topic is closed to new replies.

Advertisement