12th July 2015 by aegeuana_sjp_admin

TCP Socket States

Sockets are a way of opening a full duplex communication between two end points, in order to open the communication certain negotiation is required between the both parties, this negotiation is done by
sending a special crafted packet with to indicate the different states. The Socket states indicate the current state in which the socket is in, this tutorial assume a basic knowledge of *BSD sockets.
There are several socket states.
Indicates that the socket is in listening mode and is ready to accept a new connection.
The client sent the syncronous request and is waiting for a response from the server.
At this stage both ends are ready to send data, the data can flow both ways (full duplex).
The remote host wants to close the connection, the client will will be in this state.
This is similar to FIN_WAIT_1 but is sort of grace
The client wants to close the connection
This state indicates that the connection is being dropped and is waiting for the acknolegment from the server
This state is the default state when no new connection is established, each connection will start with this state. This also means the connection is completelyt closed and acknoledged
Here is an example of a full TCP socket transition from CLOSED->ESTABLISHED->DATA TRANSFER->CLOSED


Header file of default states:
Description of TCP states:
TCP man page:

Leave a Reply

Your email address will not be published. Required fields are marked *