Transport Layer
Introduction to Transport Layer (Layer 4)
The Transport Layer is the 4th layer of the OSI Model.
Its main job is to ensure end-to-end (process-to-process) communication between applications running on different devices.
In simple words
The Transport Layer ensures that data sent by one application reaches the correct application on another computer, correctly and efficiently.
Process-to-Process Delivery
What does it mean?
- Network Layer delivers data from computer to computer
- Transport Layer delivers data from application to application
Real-Life Example
Sending a letter:
- City → Network Layer
- House number & person name → Transport Layer
How is this achieved?
Using:
- Port Numbers
- Socket Addresses
Port Addressing
A Port Number identifies a specific application running on a computer.
Example
| Application | Port Number |
|---|---|
| HTTP (Web) | 80 |
| HTTPS | 443 |
| FTP | 21 |
| SMTP (Email) | 25 |
| DNS | 53 |
Real-Life Example
- Building = Computer IP Address
- Room number = Port Number
- Person inside room = Application
Socket Addressing
A Socket = IP Address + Port Number
Example
This uniquely identifies:
- Which computer?
- Which application on that computer?
Reliable and Unreliable Connections
Reliable Connection
- Data arrives correctly
- Lost data is retransmitted
- Order is maintained
Unreliable Connection
- No guarantee of delivery
- No retransmission
- Faster but risky
Transport Layer Protocols
The main protocols are:
- UDP
- TCP
- SCTP
User Datagram Protocol (UDP)
Nature
- Unreliable
- Connectionless
- Fast
Real-Life Example
WhatsApp voice call:
- Speed is important
- Small loss is acceptable
UDP Packet Format
| Field | Size |
|---|---|
| Source Port | 16 bits |
| Destination Port | 16 bits |
| Length | 16 bits |
| Checksum | 16 bits |
Features of UDP
- No acknowledgements
- No flow control
- No congestion control
Uses
- Video streaming
- Online gaming
- Voice calls (VoIP)
Transmission Control Protocol (TCP)
Nature
- Reliable
- Connection-oriented
- Slower but safe
Real-Life Example
Online banking:
- Data must be accurate
- No loss is acceptable
TCP Packet Format (Simplified)
| Field | Purpose |
|---|---|
| Source Port | Sender application |
| Destination Port | Receiver application |
| Sequence Number | Order of data |
| Acknowledgment Number | Confirms received data |
| Flags (ACK, SYN, FIN) | Control |
| Window Size | Flow control |
| Checksum | Error detection |
TCP 3-Way Handshake
- SYN – Request to connect
- SYN-ACK – Connection accepted
- ACK – Connection established
Uses
- Web browsing (HTTP/HTTPS)
- File transfer
Stream Control Transmission Protocol (SCTP)
Nature
- Reliable
- Message-oriented
- Supports multi-streaming
Real-Life Example
Video conference:
- Chat, audio, and video sent separately
- One stream failure doesn’t stop others
Key Features
- Multiple streams in one connection
- Better than TCP for multimedia
- Used in telecom signaling (4G/5G)
Comparison Table: TCP vs UDP vs SCTP
| Feature | TCP | UDP | SCTP |
|---|---|---|---|
| Connection | Yes | No | Yes |
| Reliability | High | No | High |
| Speed | Medium | Fast | Medium |
| Error Control | Yes | Limited | Yes |
| Flow Control | Yes | No | Yes |
| Use Case | Web, Email | Streaming, Games | Telecom, Multimedia |
Summary (Exam-Friendly)
- Transport Layer ensures process-to-process delivery
- Uses port and socket addressing
- TCP → Reliable, safe, slower
- UDP → Fast, unreliable
- SCTP → Advanced, multi-stream, telecom-friendly
Congestion Control
What is Congestion?
Congestion occurs when:
The amount of data sent into the network is more than the network can handle.
Real-Life Example
A busy road during peak hours:
- Too many vehicles
- Slow movement
- Accidents and delays
Similarly, in a network:
- Too many packets
- Delay, packet loss, retransmissions
Causes of Congestion
| Cause | Explanation |
|---|---|
| High traffic | Too many users sending data |
| Limited bandwidth | Network capacity is low |
| Slow routers | Processing delay |
| Packet retransmission | Lost packets resent again |
| Buffer overflow | Router memory full |
Effects of Congestion
- Increased delay
- Packet loss
- Reduced throughput
- Network collapse (worst case)
Congestion Control vs Flow Control
| Aspect | Congestion Control | Flow Control |
|---|---|---|
| Concern | Network capacity | Receiver capacity |
| Controls | Too much traffic | Sender speed |
| Example | Traffic jam | Small bucket filling |
Techniques for Congestion Control
A. Open Loop Congestion Control (Prevention)
These techniques prevent congestion before it happens.
1. Traffic Shaping
Controls the rate of data sent.
a) Leaky Bucket Algorithm
- Data exits at fixed rate
- Excess data discarded
Real Life: Water leaking from a bucket at constant speed
b) Token Bucket Algorithm
- Tokens allow data transmission
- More flexible than leaky bucket
2. Admission Control
-
New connection allowed only if resources are available
Example: Cinema hall allowing entry only if seats are available
Closed Loop Congestion Control (Cure)
These techniques detect and reduce congestion.
1. Backpressure
-
Router informs previous router to slow down
2. Choke Packet
-
Router sends warning message to sender
3. Implicit Signaling
-
Sender detects congestion by delay or packet loss
4. Explicit Signaling
-
Router explicitly informs congestion status
TCP Congestion Control Mechanisms
1. Slow Start
- Start with small transmission
- Gradually increase speed
2. Congestion Avoidance
- Increase data rate slowly
- Prevent congestion
3. Fast Retransmit
-
Resend lost packets quickly
4. Fast Recovery
-
Reduce transmission rate, not restart completely
Quality of Service (QoS)
What is Quality of Service?
QoS refers to:
The ability of a network to provide better service to selected traffic.
Real-Life Example: Emergency vehicles get priority on roads.
Flow Characteristics (QoS Parameters)
| Parameter | Meaning |
|---|---|
| Bandwidth | Data transmission capacity |
| Delay | Time taken for data to arrive |
| Jitter | Variation in delay |
| Reliability | Packet loss rate |
Why QoS is Required?
| Application | QoS Need |
|---|---|
| Video calling | Low delay & jitter |
| Online gaming | Fast response |
| Reliability | |
| Streaming | Continuous bandwidth |
Techniques to Improve QoS
1. Scheduling Techniques
| Technique | Explanation |
|---|---|
| FIFO | First packet served first |
| Priority Scheduling | High priority first |
| Weighted Fair Queuing | Fair bandwidth distribution |
2. Traffic Shaping
Controls data flow to avoid congestion.
3. Resource Reservation
- Reserve bandwidth before transmission
- Used in multimedia communication
4. Admission Control
Reject new flows if QoS cannot be guaranteed.
5. Differentiated Services (DiffServ)
- Packets classified into priority classes
- High priority gets better service
Congestion Control vs QoS
| Feature | Congestion Control | QoS |
|---|---|---|
| Goal | Avoid overload | Ensure service quality |
| Focus | Network stability | User experience |
| Techniques | TCP control, shaping | Scheduling, reservation |
Exam-Ready Summary
- Congestion Control manages excess traffic
- QoS ensures performance for critical applications
- Open loop prevents congestion
- Closed loop detects and corrects congestion
- QoS parameters: bandwidth, delay, jitter, reliability