Trusted answers to developer questions

What is a three-way handshake in TCP?

Get the Learn to Code Starter Pack

Break into tech with the logic & computer science skills you’d learn in a bootcamp or university — at a fraction of the cost. Educative's hand-on curriculum is perfect for new learners hoping to launch a career.

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

RELATED TAGS

networks
protocols
tcp
Copyright ©2024 Educative, Inc. All rights reserved
Did you find this helpful?