What is a three-way handshake in TCP?

During handshaking, two hosts agree on protocols to be followed during their communication prior to the communication itself. In TCP, a three-way handshake takes place during connection establishment.

Steps

The steps below are the steps involved in the connection establishment:

  1. The client (a process that initiates the communication) sends a segment. The segment contains a randomly generated sequence number, and the SYN flag is set.

  2. Upon receiving the segment, the server replies with a segment that has the server’s sequence number, its window size, an acknowledgment, and the SYN flag set.

  3. The client sends its sequence number, its window size, and an acknowledgment.

The acknowledgment is always equal to the received segment’s sequence number plus one.

The illustration below visually represents the steps above:

1 of 3
Copyright ©2024 Educative, Inc. All rights reserved