I initially thought the answer to this question was "no," but Wireshark seems to be proving me wrong.
In our application we have noticed that larger TcpClient
receive buffer sizes cause multiple messages to be grouped into larger frames. When we decrease the receive buffer size to 100 bytes, Wireshark tells us that our messages aren't grouped together anymore, and we receive more, smaller frames from the server.
My understanding was that TcpClient
is operating on a higher layer, and we don't have control over frame size. My theory is that the tiny buffer size causes Windows to negotiate a tiny maximum segment size, and this causes each segment to fit inside a single frame. Am I way off here?
According to Microsoft Docs...
The ReceiveBufferSize property gets or sets the number of bytes that you are expecting to store in the receive buffer for each read operation. This property actually manipulates the network buffer space allocated for receiving incoming data.
That doesn't help much.
It turns out having a small buffer size causes the TCP connection to have a smaller window size. This window size gets communicated to the remote machine so it will know how much data it can send at a time. So yes, setting the buffer size to a sufficiently small value will cause the remote machine to send data in smaller chunks.