TCP Handshake

The TCP protocol is also calles as an connection oriented protocol that uses handshake protocol for the client and server.

The client sends the “SYN” package to the server which receives the package and then again sends the “SYN + ACK“ package to the client back.

Now the Client receives the “SYN + ACK“ which means that the client is now aware that the server has received the SYN package and also the client then sends teh ACK package to the server which completes the 3 way handshake

What is a TCP 3-way handshake process?

This TCP-3 way handshake is important as this leads to the client and the server to know that the connection is established and both the parties are ready to receive the data now. The lines are set-up and that leads to given data for the communication.

This is a way of sying hello to the client-server.

In TCP, sequence numbers and acknowledgments (ACKs) are crucial for reliable data transmission

  1. Sequence Numbers:

    Each byte of data is assigned a unique sequence number.

    The sequence number in TCP segment indicates the byte number of the first byte of data in that segment.

  2. Acknowledgement Numbers(ACKs): When a receiver receives a segment of data, it sends an acknowledgement number to the sender.

    The ACK number in a TCP segment indicates the next byte that receiver expects to receive.

How it works

  • Establish connection: During TCP handshake (SYN, SYN-ACK, ACK) both sides exchange initial sequence numbers.
  • Data Transmission:

    The sender includes a sequence number in each segment it sends.

    The receiver inclueds an acknowledgement number in each segment it sends back.

    The acnkowledgement number acknowledges the recipt of all data up to the specified byte number.

Example :

  • Sender sends a segment with sequence number 100 and databytes 100-119

  • Receiver receives the segment and sends an ack with acknowledgement number 120. This means all the byte upto 119 and 119 is received.