Page 182 - DCAP406_DCAP_207_Computer Networks
P. 182
Unit 11: Transport Layer
Flow control in TCP is handled by using a variable size sliding window protocol. The window Notes
fields indicate how many bytes may be sent starting art the byte acknowledgment. The
acknowledgment segment (ACK) has positive acknowledgment and flow control functions. The
acknowledgment indicates to the sender the amount of data received and the data, which can be
received further. The acknowledgment number is the sequence number of the next byte the
receiver is about to receive.
Figure 11.8 illustrates a TCP data stream that begins with an ISN of 0. The destination machine
has received and acknowledged 2000 bytes. Therefore, the current acknowledgment number is
2001. The destination machine has enough buffer space for another 6000 bytes. The source
machine is currently transmitting a segment of 1000 bytes starting with sequence number 4001.
The source machine has received no acknowledgment for the bytes from 2001 onwards, but
continues transmitting data as long as it is within the window. When the source machine fills the
window and receives no acknowledgment of the data previously sent, it will, after time-out,
transmit the data again beginning from the first unacknowledged byte. In Figure 11.8
re-transmission begins from byte 2001 when no further acknowledgments are received. This
makes source machine to believe that data is reliably received at the remote locations of the
network.
TCP also ensures for delivering data received from IP to the correct application. 16-bit port
number identifies the application. The source machine and destination machine ports are included
in the first word of the segment header. Thus, transport layer passes data to and from the
application layer correctly.
Figure 11.8: TCP Data Stream
TCP Connection Management
The three-way handshake is used to create TCP connections in which the host machine executes
a CONNECT primitive, specifying the IP address and port to which the connection is required,
the maximum TCP segment size it is willing to accept and optionally some user data. The
CONNECT primitive forwards a TCP segment with the SYN bit set to 1 and ACK bit set to 0 and
waits for response. The sequences of events are illustrated in the Figure 11.8. The TCP entity at
destination examines the segment when it reaches to the destination to ensure if there is a
process that has done a LISTEN on the port that is provided in the Destination Port field. If not,
it sends a reply with the RST bit on to reject the connection. The TCP connections are full duplex,
which may be considered as a pair of simplex connections. A TCP segment with FIN bit set to 0
is sent by either of the hosts to release a connection when that host finishes of data to transmit.
On the acknowledgment of FIN, the point-to-point connection from transmit side is closed.
However, data may continue to flow indefinitely in other directions. When both directions are
shutdown, the connection is released. To avoid unnecessary delay in receiving the
LOVELY PROFESSIONAL UNIVERSITY 175