TCP Connection Management
Before exchanging data, sender and receiver process handshake to:
- agree to establish connection (each knowing the other is willing to establish connection).
- agree on connection parameters (e.g., starting sequence #).
- decides buffer size for flow control.
2-way handshake problem

- The server may receive extraneous connection request due to delay.
- This holds server resources wastefully, not knowing what happended on the client side.
- This can be used as DDos attack by invoking many hanging connections.
TCP 3-way handshake


- Client chooses initial sequence number
xand sends TCPSYN(synchronization) message to the client.- This doesn’t involve ACK yet.
- Server also chooses initial sequence number
yand sends TCPSYNACKmessage, acknowledging client’sSYN.- Server doesn’t commit to connection yet.
- Client receives
SYNACK(x)which indicates the server is alive, and sends ACK for server’sSYNACK.- This segment can contain client-to-server data.
- Server receives
ACK(y)which indicates the client is alive. - Then, connection establishment is agreed.
Closing a TCP connection
- Client and server each close their side of connection.
- each sends TCP segement with
FINbit = 1.
- each sends TCP segement with
- Receiver responds to received
FINwith ACK.- on receiving
FIN, ACK can be combined with ownFINto agree on closing the connection.
- on receiving
- Simultaneous
FINexchanges can be handled. - This means that client has to send “close request” and receive ACK for reliable termination.