Weird send() problem (with Wireshark log)

Posted by Meta on Stack Overflow See other posts from Stack Overflow or by Meta
Published on 2010-04-21T21:37:34Z Indexed on 2010/04/23 0:03 UTC
Read the original article Hit count: 151

Filed under:
|
|

I had another question about this issue, but I didn't ask properly, so here I go again!

I'm sending a file by sending it in chunks. Right now, I'm playing around with different numbers for the size of that chunk, to see what size is the most efficient.

When testing on the localhost, any chunk size seems to work fine. But when I tested it over the network, it seems like the maximum chunk size is 8191 bytes. If I try anything higher, the transfer becomes extremely, painfully, slow.

To show what happens, here are the first 100 lines of Wireshark logs when I use a chunk size of 8191 bytes, and when I use a chunk size of 8192 bytes: (the sender is 192.168.0.102, and the receiver is 192.168.0.100)

8191: http://pastebin.com/E7jFFY4p

8192: http://pastebin.com/9P2rYa1p

Notice how in the 8192 log, on line 33, the receiver takes a long time to ACK the data. This happens again on line 103 and line 132. I believe this delay is the root of the problem.

Note that I have not modified the SO_SNDBUF option nor the TCP_NODELAY option.

So my question is, why am I getting delayed ACKs when sending files in chunks of 8192 bytes, when everything works fine when using chunks of 8191 bytes?

Edit:

As an experiment, I tried to do the file transfer in the other direction (from 192.168.0.100 to 192.168.0.102), and surprisingly, any number worked! (Although numbers around 8000 seemed to perform the smoothest).

So then the problem is with my computer! But I'm really not sure what to check for.

Edit 2:

Here is the pseudocode I use to send and receive data.

© Stack Overflow or respective owner

Related posts about winsock

Related posts about Windows