TCP goes through multiple state in its lifetime, those states are:
CLOSED: This is the state of the client and server, when none of them have initiated the connection that is no connection at all.
LISTEN: This is the state of the server(passive) and is awaiting for the connection request(SYN) from the client side.
SYN-SENT:
This state represent that connection initiation(SYN) is sent and is waiting for the matching connection request from other end.
SYN-RECEIVED: This state represent that waiting for an acknowledgement once SYN has been sent and also received.
ESTABLISHED: This state represent that connection is established and data can be transmitted.
FIN_WAIT-1: This state represent waiting for the acknowledgement of the previously sent FIN request or waiting for the connection termination(FIN) from the other end.
FIN-WAIT-2:
This state is reached when the ACK is received for the FIN request sent previously. So this is like one way connection is terminated and that entity will not send any further data except for the ACK for the FIN from other end.
CLOSING:
This state is reached when the client does not receive ACK for its FIN request sent rather it also receives FIN from other end. So in this state client is waiting for the ACK for the FIN request sent.
Its like both the parties simultaneously send the FIN request.
CLOSED-WAIT:
This state comes once the end point has received FIN and send ACK for it and is waiting for request to terminate connection locally. Means now the entity has to send FIN and is waiting to do so.
TIME_WAIT:
This state represents that it is waiting for the last ACK to reached to the other end point, sent in response of its FIN request.
LAST_ACK:
Once the end point sends the FIN, it goes into LAST-ACK that is waiting for the last ACK to receive from the client side.
Categories: Networking
Leave a Reply