Main index | Section 2 | 日本語 | Deutsch | Options |
#include <sys/socket.h>
The backlog argument defines the maximum length the queue of pending connections may grow to. The real maximum queue length will be 1.5 times more than the value specified in the backlog argument. A subsequent listen() system call on the listening socket allows the caller to change the maximum queue length using a new backlog argument. If a connection request arrives with the queue full the client may receive an error with an indication of ECONNREFUSED, or, in the case of TCP, the connection will be silently dropped.
Current queue lengths of listening sockets can be queried using netstat(1) command.
Note that before FreeBSD 4.5 and the introduction of the syncache, the backlog argument also determined the length of the incomplete connection queue, which held TCP sockets in the process of completing TCP's 3-way handshake. These incomplete connections are now held entirely in the syncache, which is unaffected by queue lengths. Inflated backlog values to help handle denial of service attacks are no longer necessary.
The sysctl(3) MIB variable kern.ipc.soacceptqueue specifies a hard limit on backlog; if a value greater than kern.ipc.soacceptqueue or less than zero is specified, backlog is silently forced to kern.ipc.soacceptqueue.
If the listen queue overflows, the kernel will emit a LOG_DEBUG syslog message. The sysctl(3) MIB variable kern.ipc.sooverinterval specifies a per-socket limit on how often the kernel will emit these messages.
This secondary queue, like the primary listen queue, is sized according to the backlog argument.
[EBADF] | |
The argument s is not a valid descriptor. | |
[EDESTADDRREQ] | |
The socket is not bound to a local address, and the protocol does not support listening on an unbound socket. | |
[EINVAL] | |
The socket is already connected, or in the process of being connected. | |
[ENOTSOCK] | |
The argument s is not a socket. | |
[EOPNOTSUPP] | |
The socket is not of a type that supports the operation listen(). | |
LISTEN (2) | April 14, 2020 |
Main index | Section 2 | 日本語 | Deutsch | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
“ | F U cn rd dis U mst uz Unix. | ” |