All Articles

TCP and the 3 Way handshake

Published 7 May 2020

The TCP 3 way handshake process

The transport layer of the OSI model deals with data transfer protocols like TCP (Transmission Control Protocol) and UDP (User Diagram Protocol ).

TCP/IP is referred to as a connection based protocol. It’s the most prevalent of the 2 as it provides reliable communication of data with something called Positive Acknowledgement with Retransmission (PAR).

With TCP every time we send data as the sender, we require a receipt of acknowledgement from the receiver device that our data has arrived and in the correct order. TCP numbers the data packets before sending in order for the receiver to repackage it in the correct order and determine if any data is missing. If so, the receiver can send a retransmission request to the sender to get the correct data it needs to repackage.

Here is a simple example of the three-way handshake process:

Step 1: The client begins the connection by sending the TCP SYN packet to it’s server destination. The packets contain a random sequence number (For example, 1234) that indicates the beginning of the sequence for data that the client should transmit.

Step 2: After that, the Server will receive the packet, and it responds with it’s sequence number. The response also includes the acknowledgement number, that is the clients sequence number incremented with 1 (Here, it is 1235).

Step 3: Client responds to the Server by sending the acknowledgement number that is the server’s sequence number incremented by 1. After the data transmission process is over, TCP automatically terminates the connection between two separate endpoints.

3 way handshake diagram