The TCP three-way handshake in Transmission Control Protocol (also called the three message handshake) is the method used to establish TCP socket connections and tear down TCP socket connections over the network. TCP's three way handshaking technique is referred to as the 3-way handshake or as "SYN-SYN-ACK" (or more accurately SYN, SYN-ACK, ACK). The TCP handshaking mechanism is designed so that two computers attempting to communicate can negotiate the parameters of thenetwork TCP socket connection before beginning communication. This three way handshaking 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 physicalnetwork interface (such as ethernet) to be multiplexed.
3-Way Handshake DescriptionBelow is a (very) simplified description of the TCP 3-way handshake process. Have a look at the diagram on the right as you examine the list of events on the left.
EVENTDIAGRAMHost A sends a TCP SYNchronize packet to Host BHost B receives A's SYN
Host B sends a SYNchronize-ACKnowledgement
Host A receives B's SYN-ACK
Host A sends ACKnowledge
Host B receives ACK.
TCP socket connection is ESTABLISHED.
TCP Three Way Handshake
(SYN,SYN-ACK,ACK)
When the communication between two computers ends, another 3-way communication is performed to tear down the TCP socket connection. This setup and teardown of aTCP socket connection is part of what qualifies TCP a reliable protocol. TCP also acknowledges that data is successfully received and guarantees the data is reassenbled in the correct order.