Via setsockopt(socket, SOL_SOCKET, SO_RCVBUF, n, 4) it is possible to increase/decrease the socket receive buffer where n is the number of byte. Internally the specified number is doubled to cover bookkeeping overhead. The minimum value is defined as SOCK_MIN_RCVBUF (256 byte). It is not possible to specify any smaler value. Even if the user specified something smaller the actual buffer is silently increased to SOCK_MIN_RCVBUF (the man page is a little bit outdated and stated that setsockopt will return with a failure - this is not correct).

if ((val * 2) < SOCK_MIN_RCVBUF)
        sk->sk_rcvbuf = SOCK_MIN_RCVBUF;

The default value for the socket receiver buffer is specified in /proc/sys/net/core/rmem_default, the maximum value is specified by /proc/sys/net/core/rmem_max. sysctl_rmem_default is initialized as to:

__u32 sysctl_rmem_default __read_mostly = (sizeof(struct sk_buff) + 256) * 256;

The size of struct sk_buff is not constant a

tcp_select_initial_window() determine a initial window to offer and the corresponding window scale factor. This function is a little bit


sysctl_tcp_adv_win_scale is initialized to 2.


Finally, the man page entry is not correct: if the user specified a too small value the setsockopt call will return with no error but silently set the buffer to the smallest legal value: