TCP
T
ransmission C
ontrol P
rotocol
Initiation
Operates through a 3 way opening handshake
- The client sends a Syn segment to the server with a randomly generated sequence number. The client enters the Syn state.
- The server, currently in the LISTEN state (assuming it is online), responds with a Syn/Ack segment, containing its own randomly generated sequence number. The server enters the Syn state.
- The client responds with an Ack segment. The client assumes the connection is ESTABLISHED.
- The server opens a connection with the client and enters the ESTABLISHED state.
Termination - Abrupt
Terminates communication abruptly with an Rst segment
Termination - Graceful
Graceful exit to the connection is done through a 4-way handshake consisting of:
- Client Fin (enters Fin-WAIT1 state) --> Server
- Server Ack (enters CLOSE-WAIT state) --> Client
- Client (Receives Ack and enters Fin-WAIT2 state) --> Server
- Server Fin (enters LAST-Ack state) --> Client
- Client Ack (enters TIME-WAIT state) --> Server
- The client sends a Fin segment to the server and enters the Fin-WAIT1 state.
- The server responds with an Ack segment and enters the CLOSE-WAIT state.
- The client receives the Ack segment and enters the Fin-WAIT2 state. The server sends its own Fin segment to the client and goes to the LAST-Ack state.
- The client responds with an Ack and enters the TIME-WAIT state. After a defined period, the client closes its connection.
- The server closes the connection when it receives the Ack from the client.
Backlinks