Sunday, 20 May 2018

TCP Three-way Handshake

The TCP three-way handshake also called the TCP-handshake.  Three message handshake and/or SYN SYN-ACK ACK is the method used by TCP set up a TCP/IP connection over an IP based network. TCP's three-way handshaking is often referred to as SYN, SYN-ACK, ACK technique because there are three messages transmitted by TCP to negotiate and start a TCP session between two hosts.


Hosts on the network follow each data segment within a session and exchange information about what data is received using the information in the TCP header. TCP is a full-duplex protocol, where each connection represents two one-way communication streams or sessions. To establish the connection, the hosts perform a TCP three-way handshake. Control bits in the TCP header indicate the progress and status of the connection.


The TCP handshaking mechanism is designed that two hosts attempting to communicate can negotiate the parameters of the. TCP socket connection before transmitting data. This 3-way handshake process is also designed so that both ends can initiate and negotiate separate TCP socket connections at the same time. Being able to negotiate multiple TCP socket connections in both directions at the same time allows a single physical network interface, such as Ethernet, to be multiplexed to transfer multiple streams of TCP data simultaneously.




The step of the TCP three-way handshake



  • Establishes that the destination device is present on the network; Host A sends a TCP SYNchronize packet to Host B

  • Verifies that the destination device has an active service and is accepting requests on the destination port number that the initiating Host intends to use. Host B receives A's SYN and then Host B sends a SYNchronize-ACKnowledgement

  • Informs the destination device that the source Host intends to establish a communication session on that port number; Host A receives host B's SYN-ACK and then Host A sends ACKnowledge

  • Host B receives Host A’s ACK. And then TCP socket connection is ESTABLISHED.


The figure illustrates the step of the three-way handshake.


TCP three-way handshake


After the data sending is completed, the sessions are closed, and the connection is terminated. The connection and session mechanisms enable TCP’s reliability function. Here, another 3-way communication is performed to tear down the TCP socket connection. This setup and teardown of a TCP socket connection is part of what qualifies TCP a reliable protocol. TCP also acknowledges that data is successfully received and guarantees the data is reassembled in the correct order.

No comments:

Post a Comment