TCP 3 Way Handshake

For data to be sent across the Internet, traffic is sent over either TCP or UDP. This post will focus on how a TCP session is established, for more information on the differences between UDP and TCP click here.

In order for a TCP session to be established between 2 devices, a process known as the TCP 3 Way Handshake must occur.

How It Works

We know that TCP uses sequence numbers when sending packets, this is part of how the order of packets are verified, and a great way to identify any missing data that might have been lost in transit.

When it comes to the 3 Way Handshake, we have 3 types of communication occurring:

  1. Synchronise [SYN]
  2. Synchronise-Acknowledgement [SYN-ACK]
  3. Acknowledgement [ACK]

To put this into context, let’s say we have 2 devices, Host A and Host B. Host A is trying to establish a TCP connection with Host B.

Step 1:

Host A first sends a Synchronise Packet to Host B essentially signalling its intention to establish a TCP connection.

Screenshot - 16_10_2017 , 16_04_35

Step 2:

Host B receives the Synchronise Packet and sends its own Packet back Acknowledging it received the Synchronise Packet.

This is known as a SYN-ACK Packet.

Screenshot - 16_10_2017 , 16_11_26.png

Step 3:

Host A receives the SYN-ACK Packet and sends a final Acknowledgement Packet to confirm the SYN-ACK Packet was received successfully.
Screenshot - 16_10_2017 , 16_14_52.png

At this stage, the requirements to establish a TCP connection have been established and the to hosts may now communicate using TCP.



Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.

Subscribe to Blog

Enter your email below to subscribe to this blog.