Page 180 - DCAP406_DCAP_207_Computer Networks
P. 180
Unit 11: Transport Layer
TCP Protocol Notes
Each byte on a TCP connection is comprised of its own 32-bit sequence number. The sending and
receiving TCP entities transfer data in segments, which is determined by the TCP software. The
TCP segment has a fixed 20-byte header followed by zero or more data bytes. The TCP
functionalities support aggregation of data from several writes into one segment or split data
from one write over multiple segments. The TCP segment should be such that it should fit into
the MTU of each network. When a TCP segment is transmitted, a timer is also set. If the TCP
segment timer goes off before the acknowledgement is received, the sender transmits the segment
again. Therefore it is said that TCP is a reliable end-to-end delivery.
Reliable: TCP provides reliable delivery of data using Positive Acknowledgment with Re-transmission
(PAR) mechanism. PAR is a mechanism where the data is transmitted again and again until it
hears from the remote system that the data arrived correctly. The unit of data exchanged between
source and destination host is called a segment as shown in the Figure 11.6. It is clear from the
Figure 11.6 that each segment has a checksum to verify that the data arrives at the destination
end undamaged. When the data segment is received undamaged, the receiver sends a positive
acknowledgment back to the source end. When the data segment is damaged, the destination
machine discards it. When the source machine does not receive any positive acknowledgement
with in a specified time out period, it re-transmits the data segment.
Connection-oriented: TCP creates a logical end-to-end connection between the source and
destination hosts. Handshake that is control information is exchanged between the source and
destination hosts to set a dialogue before data is sent. TCP indicates the control function in a
segment by setting the flag in a Flags field in the segment header. TCP uses a three-way handshake
that indicates that three segments are exchanged. Figure 11.7 depicts the simplest form of the
three-way handshake. Host A initiates the connection by transmitting host B a segment with the
“Synchronize sequence numbers” (SYN) bit set. This segment indicates to host B that host A
requests to create a connection. The segment also indicates to host B the sequence number host
A will use as a starting number for its segments so that data can be put in the proper order. Host
B replies to host A with a segment that has the “Acknowledgment” (ACK) and SYN bits set. Host
B’s segment acknowledges the receipt of A’s segment and tells host A the Sequence Number host
B will begin with. Finally, host A transmits a segment that acknowledges receipt of host B’s
segment. Thus, host A transfers the first actual data.
This exchange of data also indicates to the TCP of host A has indication that the remote TCP is
active and ready to receive data. When the connection is created, data can be exchanged. As soon
as the source and destination machines have completed the data exchange, they initiate a three-
way handshake with segments containing the “No more data from sender” bit (called the FIN
bit) to release the connection. Thus, end-to-end exchange of data using the logical connection
between the source and host machines is accomplished.
TCP Segment Header
Figure 11.6 shows the layout of a TCP segment:
Source and Destination Port (Socket) numbers: They together identify the connection
between two hosts.
Sequence and Acknowledgement number: These fields perform their functions and are
32 bits long because every byte of data is numbered in a TCP stream.
TCP header length: It indicates how many 32-bits words are contained in the TCP header.
Option Field: It is of variable length and includes the TCP header length.
LOVELY PROFESSIONAL UNIVERSITY 173