Transport Layer
The transport layer is the 4th layer in the OSI model and is responsible for end-to-end (port-to-port). communication over a network.
Services of Transport Layer
Transport Layer uses the TCP or UDP protocols to provide its various services. When the data comes to the Transport layer, the TCP or UDP header is added to this data. This header adds some functionality. The services provided by the transport layer through TCP or UDP protocols are given below
1. End-to-End Delivery (Port-to-Port Delivery)
End-to-end delivery at the transport layer means delivering data from a specific process (application) on the source device to the correct process on the destination device.
-
Mechanism: Uses port numbers to identify source and destination processes.
-
Protocols Involved: TCP and UDP both support this.
-
Example: When you use a web browser, data is sent to port 80 or 443 on the web server. The browser and server applications are processes using these ports.
2. Segmentation and Reassembly
Segmentation and reassembly are the basic tasks of the transport layer. The transport layer breaks large data from the application layer into smaller segments. At the receiving end, these segments are reassembled into the original message.
-
Why It’s Needed: The network has limits on how much data it can carry in one go (MTU – Maximum Transmission Unit).
-
Mechanism: Each segment has a sequence number so they can be reassembled in the correct order.
-
Example: Sending a large email attachment – it’s broken into smaller pieces, sent, and then reassembled at the receiver.
3. Full Duplex Communication
The transport layer supports full duplex communication, allowing data to be sent and received simultaneously between devices.
-
Supported By: TCP (not UDP).
-
Benefit: Makes communication faster and more interactive.
-
Example: In a voice call over the internet, both users can talk at the same time without waiting for the other to finish.
4. Connection-Oriented Communication
The transport layer deals with connection-oriented communication by using the TCP protocol. Before data transmission, a connection is established between the sender and receiver.
-
How It Works: TCP uses a 3-way handshake to establish the connection.
-
Benefit: Ensures both devices are ready and synchronized for communication.
-
Limitation: Requires extra overhead (setup, management, and termination of connection).
-
Example: Downloading a file from a server via HTTP over TCP.
5. Reliable Delivery
Reliable delivery ensures that data reaches the destination correctly and completely. It includes the following sub-services:
i. Error Control
-
Definition: Detects errors during transmission using checksums.
-
How: The sender adds a checksum to each segment. The receiver checks this to detect corruption.
-
Note: Unlike the Data Link Layer (which provides hop-to-hop error checking), the transport layer provides end-to-end error control.
Important: Error checking at different layers table
OSI Layer | Protocol Example | Error Check Method | What It Checks | Action on Error |
---|---|---|---|---|
Transport (L4) | TCP, UDP | Checksum | Header + Data (TCP) | Discard segment |
Network (L3) | IP | Header Checksum (IPv4) | IP header only | Discard packet |
Data Link (L2) | Ethernet, Wi-Fi | CRC / FCS | Entire frame | Discard frame |
ii. Sequence Control
-
Definition: Maintains the correct order of data segments.
-
Use Case: If data segments arrive out of order, they can be rearranged using their sequence numbers.
-
Example: Segment P3 arrives before P2 – sequence control helps reorder them as P1, P2, P3.
iii. Loss Control
-
Definition: Ensures lost data is detected and retransmitted.
-
Mechanism: The receiver sends acknowledgments (ACKs). If a segment isn’t acknowledged, it is retransmitted.
iv. Duplication Control
-
Definition: Ensures duplicate segments are not processed multiple times.
-
Mechanism: Uses sequence numbers to detect and discard duplicates.
6. Flow Control
Transport layer supports flow control property, which prevents the sender from overwhelming the receiver with too much data.
-
Mechanism: Uses Sliding Window Protocol, where the sender can send multiple segments before needing an acknowledgment, but within a limit.
-
Why It’s Important: If the receiver’s buffer overflows, data can be lost or require retransmission, reducing efficiency.
-
Example: Like pouring water into a bottle—if you pour too fast, it overflows.
7. Multiplexing and Demultiplexing
Multiplexing and Demultiplexing are essential for the transport layer to work with different applications running in a computer at a time. Multiplexing involves combining data from various applications into a single stream for transmission. Demultiplexing is the process of separating the received data and delivering it to the appropriate application process.
-
How: Done using port numbers.
-
Example: Your computer runs a web browser, an email client, and a video call simultaneously. All send/receive data over the same network, but each application is identified and handled separately.
Summary Table
Service | Description | Protocol Used |
---|---|---|
End-to-End Delivery | Ensures data goes to the correct application (port-to-port). | TCP & UDP |
Segmentation & Reassembly | Breaks large data into smaller segments and reassembles them. | TCP |
Full Duplex | Supports simultaneous send/receive. | TCP |
Connection-Oriented Comm. | Sets up a reliable connection before transferring data. | TCP |
Reliable Delivery | Ensures correct, complete, and duplicate-free delivery. | TCP |
Flow Control | Prevents sender from overwhelming the receiver. | TCP (Sliding Window) |
Multiplexing | Manages multiple applications using port numbers. | TCP & UDP |