1838469 Members
2714 Online
110126 Solutions
New Discussion

Re: socket buffer

 
Kapil_2
Advisor

socket buffer

Hi everyone,

I have a server and client running on the HPUX 11.0

Case 1
------
SO_RCVBUF of server = 32768.
SO_SNDBUF of client = 32768.
The client is able to write 115000 bytes approx. without the server reading a single byte.

Case 2
------
SO_RCVBUF of server = 1024.
SO_SNDBUF of client = 32768.
The client is able to write 35000 bytes approx. without the server reading a single byte.

Case 3
------
SO_RCVBUF of server = 1024.
SO_SNDBUF of client = 1024.
The client is able to write 3200 bytes approx. without the server reading a single byte.

The obvious question is why am i able to write more data than the size of the buffer?
Is SO_RCVBUF,SO_SNDBUF the true size of the buffer?
If no then how do we find the true size?

Kapil
1 REPLY 1
rick jones
Honored Contributor

Re: socket buffer

a partial explanation is that there is a bit of "double buffering" in the HP-UX 11 stack. however, TCP window advertisements are honored

also, even without the double-buffering, the amount that can be sent before the client would block completely is the sum of the client's SO_SNDBUF and the server's SO_RCVBUF. the client sends serverSO_RCVBUF worth of data, which is received and ACKed by the server's tcp. the server's tcp then advertises a zero window.

since the data was ACKed, the client TCP can remove it from his SO_SNDBUF. the client app is now free to put fresh data into the SO_SNDBUF, awaiting a window update from the server, which will be sent once the server app starts reading data from his socket.
there is no rest for the wicked yet the virtuous have no pillows