Networking Technology: TCP 3-Way Handshake

networking-technology:-tcp-3-way-handshake

computer data matrix

We use TCP (Transfer Control Protocol) for transmitting data in a network, but why prefer TCP over any other protocol?

TCP provides security and reliability to any connection between two devices on a network. This security is only possible due to the three-way handshake method in TCP. Let us learn about the three-way handshake in this post.

TCP 3-Way Handshake

 The three-way handshake in Transfer Control Protocol is also known as TCP handshake. The three-way handshaking method is also known as the SYN-SYN-ACK because of the three messages sent by TCP to negotiate the connection between two devices. SYN stands for synchronization, whereas ACK stands for acknowledgment.

It is a three-step method which allows both the sender and receiver’s end to check the parameters of a network at the same time before data is transmitted. TCP can send multiple socket connections at the same time in both directions.

Steps of the 3-way handshake:

1. Connection between server and client

The target server should have open ports to accept and start a new connection. Once it is open, a connection is established between and server and the client. The client sends a SYN (synchronize) packet to the server over an IP network. SYN packet contains a random number the client wants to use for the communication. The objective of this process is to know whether the server is open for connection.

2. Server responds to the SYN packet

If available, the server receives the SYN packet from the client and returns a confirmation receipt. The confirmation receipt comprises of an ACK packet (acknowledgment) or SYN/ACK packet. There are two sequence numbers in this packet. The ACK packet has one number more than the sequence number it received from the client. SYN packet is another random number sent by the server. The sequence means to portray that the server has acknowledged the client’s wish to connect.

3. Client responds to the SYN-ACK packet

When the client receives the SYN-ACK packet from the server, it is time to acknowledge this message in return. The client will acknowledge the communication by adding another number to the sequence number and send it to the server. When this process is complete, a connection is established between these two entities.

Both hosts are capable of detecting a missing or faulty segment by acknowledging connection parameters. Therefore, any missing segment will be quickly detected before data transmission. When the communication between two entities ends, another three-way communication begins to tear down the TCP connection. This setup and tearing down of connection is what makes TCP an efficient and reliable protocol for network communication. TCP ensures in every transaction that the data is received, and a transaction is completed with satisfaction.

TCP rides on the Internet Protocol (IP) stacks, that is why it is called the TCP/IP (TCP over IP) protocol stack. Here, IP handles the addressing and TCP manages the communication between two endpoints on a network.

It’s also worth noting that some elements from the TCP header file are used in the handshake process. These include the following:

  • Sequence number: Assigned to the first bit of data, this is a random 32 bits number from 0 to (2^32 -1)). It’s used just once.
  • Acknowledgement number: The next number expected by the sending device is this number. It’s usually 1 greater than the sequence.
  • Window size: Refers to the capacity of the buffer.
  • Maximum size segment: This is the maximum size to which a data segment can go.

Conclusion

Overall, the 3-way handshake creates a logical connection between two hosts on a TCP/IP network, and it does that by “synchronizing” the transmitting of packets to and from the host devices. Also, it’s common for the three-way handshake to communicate TCP parameters while forming a session between the hosts.

Leave a Reply

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

the-best-16-landing-page-builders-for-any-business

The Best 16 Landing Page Builders for Any Business

networking-technology:-static-ip-vs-dhcp

Networking Technology: Static IP vs DHCP