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 called 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 receiving 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 set up the connection, the hosts do a TCP three-way handshake. Control bits in the TCP header show the progress and status of the connection.
The TCP handshake mechanism designs for hosts attempting to communicate and can negotiate the limits of the TCP socket connection before transmitting data. This 3-way handshake process is also designed so that both ends can start 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
1. Host A sends a TCP SYNchronize packet to Host B
2. Host B receives Host A’s SYN
3. Host B sends a SYNchronize-ACKnowledgement to Host A
4. Host A receives Host B’s SYN-ACK
5. Host A sends ACKnowledge to Host B
6. Host B receives ACK.
The figure illustrates the step of the three-way handshake.
When data sending is complete then the sessions are going to close because of finishing sending data. The connection and session mechanisms enable TCP’s reliability function. Here, another 3-way communication is going to perform and 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 successful data receiving and guarantees the data is reassembling in the correct order.