11.1 TCP/IP Transport Layer  
  11.1.4 Three-way handshake  
TCP is a connection-oriented protocol. TCP requires connection establishment before data transfer begins. For a connection to be established or initialized, the two hosts must synchronize their Initial Sequence Numbers (ISNs). Synchronization is done through an exchange of connection establishing segments that carry a control bit called SYN, for synchronize, and the ISNs. Segments that carry the SYN bit are also called “SYNs". This solution requires a suitable mechanism for picking an initial sequence number and a slightly involved handshake to exchange the ISNs.

The synchronization requires each side to send its own initial sequence number and to receive a confirmation of exchange in an acknowledgment (ACK) from the other side. Each side must also receive the INS from the other side and send a confirming ACK. The sequence is as follows:

  1. A→B SYN—(A) initial sequence number is X, ACK number is 0, SYN bit is set, but ACK bit is not set.
  2. B→A ACK—(A) sequence number is X + 1, (B) initial sequence number is Y, and SYN and ACK bit are set.
  3. A→B ACK—(B) sequence number is Y + 1, (A) sequence number is X + 1, the ACK bit is set, but the SYN bit is not set.

This exchange is called the three-way handshake.

A three-way handshake is necessary because sequence numbers are not tied to a global clock in the network and TCP protocols may have different mechanisms for picking the ISN. The receiver of the first SYN has no way of knowing whether the segment was an old delayed one, unless it remembers the last sequence number used on the connection. Recalling that number is not always possible Therefore, the receiver must ask the sender to verify this SYN.

 

Web Links

3-Way Handshake

http://www.cs.panam.edu/~meng/Course/ CS6345/Notes/ chpt-6/node8.html