DATA COMMUNICATION AND NETWORKING
Connection Oriented Transport - TCP
Dr. Veena S
Department of Computer Applications
DATA COMMUNICATION AND NETWORKING
Connection Oriented Transport Protocol - TCP
Transmission Control Protocol (TCP) is a connection-oriented,
reliable protocol
TCP explicitly defines connection establishment, data transfer,
and connection teardown phases to provide a connection-
oriented service
TCP uses a combination of GBN and SR protocols to provide
reliability
TCP is defined in RFC 793, RFC 1122, RFC 2018, RFC 5681, and
RFC 7323
DATA COMMUNICATION AND NETWORKING
Transmission Control Protocol - TCP
It is a connection-oriented protocol
Both sides of connection initializes and maintains several state
variables
Runs only in end systems
- no continuous circuit like VC
TCP connection is always point-to-point. i.e., always between a
single sender and single receiver.
It provides a full duplex service.
DATA COMMUNICATION AND NETWORKING
TCP Services
Services offered by TCP
- Process-to-Process Communication – uses port numbers
Stream Delivery Service
- TCP is a stream oriented protocol, it delivers data as stream of
bytes
Sending Receiving
process process
Stream of bytes
DATA COMMUNICATION AND NETWORKING
Sending and Receiving Buffers
The sending and receiving processes may not read or write data at the same
rate. So, they need two buffers. Example shows 20 bytes buffer
Sending Receiving
process process
Stream of bytes
3 areas in sending buffer and 2 areas in receiving buffer
DATA COMMUNICATION AND NETWORKING
TCP Segment creation
TCP groups a number of bytes together into a packet called segments
TCP adds header to each segment for control purpose and delivers to
network layer for transmission
How many bytes in one segment?
Segments may be of different size
DATA COMMUNICATION AND NETWORKING
Transmission Control Protocol - TCP
The maximum amount of data that can be placed in a segment is
limited by the maximum segment size (MSS).
The MSS value depends on the length of the largest link layer
Frame. (MTU value of the link)
For eg: both Ethernet and PPP protocol have an MTU value of
1500 bytes. Thus, a typical MSS Value is 1460 bytes.
(1460 + 20bytes IP Header + 20 Bytes TCP Header)
Note that the MSS is the maximum amount of application-layer
data in the segment.
Now TCP adds its header to form a segment. Now it is ready to go.
DATA COMMUNICATION AND NETWORKING
TCP Services
Full-Duplex Communication – data can flow in both directions
Multiplexing and Demultiplexing
Connection-Oriented Service – two TCPs establish a logical
connection between them, Data exchanged in both directions
and finally the connection termination happens.
Reliable Service – uses acknowledgement mechanism to check
for the safe and sound arrival of data
Provides Flow Control, Error Control and Congestion Control
DATA COMMUNICATION AND NETWORKING
TCP – Usage of Numbers
TCP uses the Numbering System:
Byte Number – every byte is numbered by TCP and it starts with
an arbitrary number (ISN). Both sides of TCP randomly chooses
the ISN(Initial Sequence Number)
Sequence Number – sequence number of the segment is the
byte number of first byte in the segment.
Acknowledgment Number – Byte number of the next byte
expected. Acknowledgements are cumulative.
DATA COMMUNICATION AND NETWORKING
TCP Features
Suppose a TCP connection is transferring a file of 5,000 bytes. The
first byte is numbered 10,001. What are the sequence numbers for
each segment if data are sent in five segments, each carrying 1,000
bytes?
The following shows the sequence number for each segment:
DATA COMMUNICATION AND NETWORKING
TCP Segment
A packet in TCP is called a segment
DATA COMMUNICATION AND NETWORKING
TCP Segment Format
The SrcPort and DstPort fields identify the source and destination
processes, respectively
TCP is a byte-oriented protocol, each byte of data has a sequence
number; the SequenceNum field contains the sequence number for the
first byte of data carried in that segment
The Acknowledgment(next byte expected) and Window size fields
carry information about the flow of data going in the opposite direction
The Hlen field tells the length of the header in 32 bit words. It can
take the value 5 – 15
The 6-bit Flags field is used to relay control information between TCP
peers
DATA COMMUNICATION AND NETWORKING
TCP Segment Format
The possible flags include URG, ACK,PSH, RST, SYN and FIN
The SYN and FIN flags are used when establishing and terminating
a TCP connection, respectively
The ACK flag is set any time the Acknowledgment field is valid,
implying that the receiver should pay attention to it
The URG flag signifies that this segment contains urgent data.
When this flag is set, the UrgPtr field indicates where the nonurgent
data contained in this segment begins. (The urgent data is contained
at the front of the segment body, up to and including a value of
UrgPtr bytes)
The RESET flag signifies that the receiver has become confused
DATA COMMUNICATION AND NETWORKING
TCP Segment Format
The PUSH flag signifies that the sender invoked the push operation,
which indicates to the receiving side of TCP that it should notify the
receiving process of this fact
Finally, the Checksum field is used in exactly the same way as for
UDP—it is computed over the TCP header, the TCP data, and the
pseudoheader
DATA COMMUNICATION AND NETWORKING
TCP Checksum Calculation - Pseudoheader
THANK YOU
Dr. Veena S, Professor and Chairperson
Department of Computer Applications
[email protected]+91 80 26721983 Extn 829