Each time a user opens his/her web browser, watches a video, or sends an email, the networking protocols operate in the background, making it all happen. Prior to sending data via Transmission Control Protocol (TCP), a client and a server have to synchronize themselves by establishing a connection. It is referred to as the TCP 3-way Handshake.

But what exactly is a TCP handshake, and why is it so important for error-free communication?

Basics: What is TCP Handshake?

TCP handshake is a protocol-specific three-step process that occurs when using the Transmission Control Protocol (TCP) to establish a connection between a client (e.g., a laptop or a smartphone) and a server (website host).

In contrast to other simple protocols that transfer data without any checks, TCP focuses on the reliability, order of data transfer, and checking of errors. The main point of the handshake is to synchronize the sequence numbers of both devices to be sure they are ready to communicate.

3-Way Handshake Process

The connection establishment is dependent upon three particular control packets, commonly referred to as SYN, SYN-ACK, and ACK. This is how the negotiation process goes step by step:

Step 1: SYN (Synchronize)

Firstly, the client sends a TCP segment having the SYN flag set to 1 to the server. The packet performs two key functions:

  • Connection Request: It informs the server about the intention of the client to establish a communication link.
  • Initial Sequence Number Generation: The client creates a random number referred to as the Initial Sequence Number (ISN), let us say 1000, to monitor future data byte transmission.

Step 2: SYN-ACK (Synchronize-Acknowledge)

In response to the client’s SYN packet, the server confirms that there are open ports available for accepting the connection request, and sends the packet having both the SYN and ACK flags set to 1:

  • Confirmation of the Reception: The server sets the Acknowledgment Number to one more than that of the client’s ISN (1001).
  • Transmission of Server Initial Sequence Number: The server forms its own Initial Sequence Number (ISN), let us say 5000.

Step 3: ACK (Acknowledge)

Finally, the client responds with a packet having the ACK bit set to 1:

  • Final Confirmation: Now, the Acknowledgment Number field is set by the client to the ISN of the server + 1 (5001) to show that it has received the answer from the server.
  • State Established: At this point, both devices enter the ESTABLISHED state and begin to exchange the actual application data (HTTP/HTTPS).

Importance of 3-Way Handshake

The presented process of the 3-way handshake has several technical benefits, making the contemporary Internet safe and stable:

  • Two-Way Synchronization: The readiness of each device to send data is checked independently by each device before the actual data transmission starts.
  • Ordering and Correctness of Data: Since the sequence numbers are established at the very beginning, TCP is able to rearrange the packets and recover the lost ones.
  • No Interference of Old Connections: Because of the sequence number synchronization, there is no possibility that some old packets will interfere with the current connection.

Potential Threats and Their Mitigations

Despite being secure and orderly, the handshake technique can be subjected to attacks by intruders. One type of attack on networks that affects this technique is the SYN Flood attack. 

In such an attack, attackers send the target server thousands of fake SYN packets that use fake source IP addresses. The following are the various strategies used by network administrators in combating these threats:

  • Use of SYN cookies is where servers allocate system memory once the final ACK packet comes.
  • Filtering of packet streams by firewalls before reaching the destination server.
  • Limiting the rate of connections based on source IP address.

Also Read: How Internet Protocol Evolution Shapes Future Connectivity 

Conclusion

Knowledge of what is TCP Handshake function is makes it clear why TCP is the foundation of communication on the Internet. a uses a disciplined handshake process which involves three steps (SYN, SYN-ACK, and ACK) to check for readiness and synchronization of the sequence numbers.

FAQs

Ans: It allows establishing a reliable and synchronized connection between two devices.

Ans: They include SYN, SYN-ACK, and ACK.

Ans: To let both sides independently confirm readiness and sequence numbers.

Tanya Negi
Tanya Negi AI & Technology Writer

Specializes in artificial intelligence, machine learning, emerging technology and digital innovation. Covers AI applications, LLMs, AI agents, synthetic data, AI security, SEO and the impact of AI on business and digital experiences.

Related Posts
×