Basic Explanation of Three-Way Handshake

A three-way handshake is a method to create a connection between a client and a server. It has 3-steps to allow both communicating ends. A three-way handshake is primarily used in TCP to reliably transmit data between devices. It supports communication between a web browser on the client-side and a server every time a user navigates the Internet.

image

Steps of Three-Way Handshake

Step 1: A connection between server and client is opened. The client node sends an SYN (Synchronize Sequence Number) data packet over an IP network to a server on the same or an external network.

Step 2: When the server receives the SYN packet from the client node, it responds and returns a confirmation receipt – the ACK (Acknowledgement Sequence Number) packet or SYN/ACK packet. This packet includes two sequence numbers.

The first one is ACK one, which is set by the server to one more than the sequence number it received from the client (e.g. X+1).

The second one is the SYN sent by the server, which is another random sequence number (for example, Y).

Step 3: The client node receives the SYN/ACK from the server and responds with an ACK packet. Once again, each side must acknowledge the sequence number received by incrementing it by one.

So now it’s the turn of the client to acknowledge the server’s packet by adding one to the sequence number (in this case, Y+1), and resend it to the server.