A process used in TCP to establish a connection between a Client and a server. It is a three-step procedure that ensures both parties are ready to exchange data before any data is transmitted.

Procedure

  1. The client sends a TCP Segments with the SYN flag, to indicate the request to establish connection. This segment includes a randomly generated sequence number, which is usually a hash of source and destination IPs and ports and is used to defend against Syn Flood attacks.
  2. When the server receives the Segment with the SYN flag, it responds with a TCP segment containing SYN and ACK flag set, to indicate that it also wants to establish a connection. This segment also includes its own randomly generated sequence number and an acknowledgement of the received segments’ sequence number.
  3. Finally the client responds to the server’s SYN-ACK segment with a segment containing the ACK flag set, to communicate that it is now ready to receive data. This segment acknowledges the server’s sequence number and may carry a segment payload.

Examples