TCP Connection Initiation
This section is
dedicated exclusively to the various queues and tunable variable(s)
used during connection instantiation. The socket API maintains some
control over the queues. But in order to tune anything, you have to
understand how listen and
accept interact with the queues. For details, see
the various books by Stevens mentioned in Section C.10.1 later in this appendix.
When the server calls listen, the kernel moves the
socket from the TCP state CLOSED into the state
LISTEN, thus doing a passive open. All TCP servers
work like this. Also, the kernel creates and initializes various data
structures, among them the socket buffers and two queues:
- Incomplete connection queue
This queue contains an entry for every
SYNthat has arrived. BSD sources assignso_q0lenentries to this queue. The server sends off theACKof the client’sSYNand sends the server-sideSYN. The connection gets queued and the kernel now awaits the completion of the TCP three-way handshake to open a connection (see Figure C.1). The socket is in theSYN_RCVDstate. On the reception of the client’sACKto the server’sSYN, the connection stays one round trip time (RTT) in this queue before the kernel moves the entry into the completed connection queue.

Figure C-1. TCP three-way handshake, connection initiation
- Completed connection queue
This queue contains an entry for each connection for ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access