Ever wondered what a Three-way handshake is ?……….
Ofcourse it is not three people shaking hands with each other!!…… It is a method used to establish and tear down connections in TCP(Tramsmission Control Protocol). It is also known as three message handshake. To be more technical it is it is reffered as SYN, SYN–ACK, ACK handshake. The TCP handshaking mechanism is designed so that two computers attempting to communicate with each other can negotiate the parameters of the network connection before beginning communication. This process is also designed so that both ends can initiate and negotiate separate connections at the same time.
It goes like this……….
1‘st shake: The machine which wants to establish the connection or ‘Host-A’ sends a TCP SYNchronise packet to the machine that has to be communicated with or in our case it is ‘Host-B’.
2‘nd shake: On recieving the Host-A’s SYN packet Host-B sends a SYNchronise-ACKnowledgement packet if the connection is possible.
3‘rd and the final shake: On receiving the SYN-ACK Host-A sends an ACKnowledgement back to Host-B and the connection is established.
If the communication is complete any one of the Host will send a FINish packet to the other host signaling the end of communication and the connection will be terminated sucesfully.
On recieving the SYN packet in the second step, If Host-B is not ready or if the port is closed or if the connection is not possible in one way or the other, Host-B sends a RST packet to terminate the connection witout establishing it completely.
Refer a good TCP/IP text for further info.