## Initiation Operates through a 3 way opening handshake - Client `syn` --> Server - Server `syn`-`ack` --> Client - Client `ack` --> Server --- 1. The client sends a `syn` segment to the server with a randomly generated sequence number. The client enters the `syn` state. 2. 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. 3. The client responds with an `ack` segment. The client assumes the connection is ESTABLISHED. 4. 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 --- 1. The client sends a `fin` segment to the server and enters the `fin`-WAIT1 state. 2. The server responds with an `ack` segment and enters the CLOSE-WAIT state. 3. 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. 4. The client responds with an `ack` and enters the TIME-WAIT state. After a defined period, the client closes its connection. 5. The server closes the connection when it receives the `ack` from the client.