Transport Layer 2
Transport Layer 2
LAYER
PART 2:TCP
Connectionless and Connection
Oriented Service
Introduction
The Transport Layer (Layer 4 of the OSI model) is responsible for end-to-end
communication between devices. It ensures reliable data transfer, flow
control, and error detection. Two key services provided by this layer are:
1.Connectionless Service
2.Connection-Oriented Service
These services define how data is transmitted between sender and receiver.
1. Connectionless Service
Definition
Explanation
Example
Definition
Explanation
Example
1. Process-to-Process Communication
Example:
•When downloading a file, TCP ensures all bytes arrive in order without gaps.
Example:
5. TCP Segments
Definition
TCP breaks the data stream into smaller units called segments for transmission. Each segment
contains a header and payload.
Key Points
Three-Phase Process
1.Connection Establishment
1. Uses 3-way handshake:
1. SYN (Client → Server)
2.Data Transfer
1. Segments transmitted with sequencing
3.Connection Termination
1. Graceful shutdown using 4-way handshake:
1. FIN (Host A → Host B)
Mechanism Function
Acknowledgments Receiver confirms segment receipt
Retransmission Timer Resends unacknowledged segments
Sequence Numbers Detects missing/duplicate data
Checksums Identifies corrupted segments
Flow Control Prevents receiver overload
TCP Features
1. Numbering System
•TCP assigns a number to each byte of data it sends.
•This numbering helps identify, track, and manage the data in transmission.
•The numbering is essential for data reassembly at the receiver’s end.
•The first byte sent during a connection has an Initial Sequence Number (ISN), randomly
selected.
•Following bytes are numbered sequentially.
Example:
If the Initial Sequence Number (ISN) is 1000,
then the next byte will be 1001, then 1002, and so on.
2. Byte Number
• Byte Number represents the position of a byte in the entire data stream.
• It allows TCP to handle out-of-order packets by reordering them correctly.
• Each byte's number helps the receiver to place it in the correct order.
Key Point:
TCP treats the data as a stream of bytes, not as separate messages.
3. Sequence Number
• A Sequence Number indicates the byte number of the first byte carried in a TCP segment.
• It is placed in the TCP header and is used for data tracking and reassembly.
Working:
• Sender assigns a sequence number to the first byte of the segment.
• If a segment carries 100 bytes, and the sequence number is 2000,
then the next segment’s sequence number will start from 2100
4. Acknowledgment
• Acknowledgment (ACK) is used to confirm the successful receipt of data.
• TCP uses an Acknowledgment Number to indicate the next expected byte from the sender.
• This ensures reliable delivery.
Example:
If the receiver successfully receives bytes up to 3000,
it sends an ACK with an Acknowledgment Number 3001.
• TCP uses positive acknowledgment (confirm what is received) and retransmission for lost data.
5. Flow Control
• Flow Control ensures that the sender does not overwhelm the receiver by sending too much data at once.
• TCP uses a Sliding Window Protocol for flow control.
• The receiver advertises a window size (number of bytes it can accept) to the sender.
Working:
• Sender can only send data within the allowed window size.
• The window size dynamically adjusts according to the receiver’s capacity.
Example:
If the window size is 5000 bytes, the sender must wait after sending 5000 bytes until an ACK is received.
6. Error Control
• Error Control ensures the reliable delivery of data without corruption.
• TCP uses checksums for error detection:
• Each segment has a checksum value.
• Receiver recalculates and compares the checksum.
• If mismatch, the segment is discarded and retransmitted.
Use Cases Web browsing (HTTP/HTTPS), Email (SMTP), Video streaming, Voice calls (VoIP), Gaming,
File Transfer (FTP) DNS queries
Header Size Larger (20-60 bytes) Smaller (8 bytes)
Ordering of Packets Guaranteed ordering No guaranteed ordering
COMPUTER
NETWORKS
SECTION 2: APPLICATION, PRESENTATION, AND SESSION LAYERS
FOR SEM V