![]() |
![]()
| ![]() |
![]()
NAME
LIBRARYStandard C Library (libc, -lc) SYNOPSIS
int
DESCRIPTIONTo accept connections, a socket is first created with
socket(2),
a willingness to accept incoming connections and a queue limit for incoming
connections are specified with
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
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 syslog message using default priority LOG_DEBUG (7). The sysctl(3) MIB variable kern.ipc.sooverprio may be used to change this priority to any value in a range of 0..7 (LOG_EMERG..LOG_DEBUG). See syslog(3) for details. It may be set to -1 to disable these messages. The variable kern.ipc.sooverinterval specifies a per-socket limit on how often the kernel will emit these messages. INTERACTION WITH ACCEPT FILTERSWhen accept filtering is used on a socket, a second queue will be used to hold sockets that have connected, but have not yet met their accept filtering criteria. Once the criteria has been met, these sockets will be moved over into the completed connection queue to be accept(2)ed. If this secondary queue is full and a new connection comes in, the oldest socket which has not yet met its accept filter criteria will be terminated. This secondary queue, like the primary listen queue, is sized according to the backlog argument. RETURN VALUESThe ERRORSThe
SEE ALSOnetstat(1), accept(2), connect(2), socket(2), sysctl(3), syslog(3), sysctl(8), accept_filter(9) HISTORYThe
|