To use reliable transport services, TCP hosts must establish a connection-oriented session with one another. Connection establishment is performed by using a "three-way handshake" mechanism because TCP is layered on the unreliable datagram service provided by IP, so that these control segments can by lost, duplicated or delivered out of order leading to trouble if original or retransmitted segments arrive while the connection is being established.
A three-way handshake synchronizes both ends of connection by allowing both sides to agree upon initial sequence number. This mechanism also guarantees that both sides are ready to transmit data and know that the other side is ready to transmit as well. This is necessary so that packets are not transmitted during session establishment or after session termination.
Each host randomly chooses a sequence number used to track bytes within the stream it is sending and receiving. The client initiates a connection by sending a packet with the initial sequence number (X) and SYN bit set to indicate a connection request. The server receives the SYN, records the sequence number x, and acknowledges the SYN (with an ACK = x+1). The server includes its own initial sequence number (SEQ=Y). An ACK=20 means the host has received bytes 0 through 19 and expects byte 20 next. This technique is called forward acknowledgment. The client then acknowledges all bytes the server has sent with a forward acknowledgment indicating the next byte it expects to receive (ACK=Y+1).
No comments:
Post a Comment
Your feedback and comments are valuable for us: