Gets or sets the normal buffer sizes allocated for output (SO_SNDBUF) and input (SO_RCVBUF) buffers. You can increase the buffer size for high-volume connections, or decrease it to limit the possible backlog of incoming data. The system places an absolute limit on these values and defaults them to at least 16K for TCP sockets.
<<<<<<<<<<<<<<<<<
so buffer sizes seem to be 16K by default. But what is the advantage of decreasing buffer size to limit the possible backlog of incoming data?
Thanks.
Increasing the size of the send buffer reduces (not eliminates) the chance that a send() call returns with the number of bytes sent being less than you tried to send. When that case happens (send returning less bytes sent than you requested be sent) you have to have logic to re-send just the bytes that didn’t get sent.
Increasing the size of the receive buffer reduces the chance that a packet arriving from a remote machine gets dropped (forcing the remote side to re-send as part of internal TCP/IP logic or be lost forever in the case of UDP) if your app hasn’t read the buffered data from the TCP/IP stack.
QNX has an upper limit of 196K (I found this by expirmentation).
Unless you are on an extremely limited system it doesn’t make sense to reduce the buffer. In fact I habitually set mine to 196K simply because I have 1 Gig of RAM on my PC104 boards.