Transport Layer
The 4th layer of the OSI model, ensuring reliable end-to-end communication between applications.
Overview & Functions
The Transport Layer works between the Application Layer and the Network Layer. Its main job is to provide end-to-end communication between applications running on different devices.
End-to-End
From the source application directly to the destination application.
Functions of the Transport Layer
1. Process-to-Process Delivery
Delivers data from one application/process to another (e.g., Browser → Web server).
2. Segmentation & Reassembly
Large data is divided into smaller segments and reconstructed at the receiver side.
3. Port Addressing
Uses port numbers (HTTP: 80, HTTPS: 443, DNS: 53) to identify which application should receive the data.
4. Flow Control
Controls the speed of data transmission so that the sender does not overwhelm the receiver.
5. Error Control
Checks for lost, duplicate, or damaged packets and corrects them if needed.
6. Multiplexing
Combines data from many applications before transmission and demultiplexes upon receipt.
TCP (Transmission Control Protocol)
Connection-Oriented & Reliable
TCP is a secure transport protocol that guarantees delivery, correct order, and error checking. It establishes a connection before communication starts using the Three-Way Handshake.
Features of TCP
- Reliable Communication Ensures no packet loss and retransmits if packets are lost.
- Ordered Delivery Packets arrive in the exact order they were sent.
- Error Checking Uses checksum to detect and recover from errors.
- Flow & Congestion Control Uses Sliding Window Protocol to control data amount and reduces traffic on congestion.
TCP Segment Header (32-Bit Grid Diagram)
TCP headers are relatively heavy, requiring 20 to 60 bytes depending on options. Click on any field block in the 32-bit memory row layout below to explore its specific function:
Advantages
- Reliable and accurate delivery
- Ordered transmission
- Error recovery
Disadvantages
- Slower transmission speed
- More overhead
- Requires connection setup time
Applications of TCP
Used where reliability is crucial:
UDP (User Datagram Protocol)
Connectionless & Fast
UDP sends data without establishing a connection. It is faster and lightweight, but it is unreliable because it does not guarantee delivery, order, or error recovery.
Features of UDP
- Connectionless No handshake process; data is directly sent.
- Faster Transmission Less overhead means higher speed.
- No Reliability Does not guarantee delivery, and does not retransmit lost packets.
- Low Latency Best suited for real-time communication.
UDP Datagram Header (32-Bit Grid Diagram)
UDP headers are extremely lightweight, requiring only 8 bytes total. Click on any field block in the 32-bit memory row layout below to explore its specific function:
Advantages
- Very fast transmission
- Low overhead
- Suitable for real-time systems
Disadvantages
- Unreliable (no acknowledgment)
- No packet ordering
- Possible packet loss
Applications of UDP
Used where speed matters more than absolute reliability:
Difference Between TCP and UDP
| Feature | TCP | UDP |
|---|---|---|
| Connection | Connection-oriented | Connectionless |
| Reliability | Reliable | Unreliable |
| Speed | Slower | Faster |
| Error Recovery | Yes | No |
| Packet Ordering | Maintained | Not maintained |
| Overhead | High | Low |
| Acknowledgment | Required | Not required |
| Applications | Web, Email, FTP | Gaming, Streaming, DNS |
Simple Real-Life Analogy
Registered Courier Service
- Delivery confirmation
- Safe and reliable
- Ordered processing
Normal Broadcasting
- Fast transmission
- No confirmation
- Some data may be lost