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:
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.
|