5.4 Transport Layer
The Transport Layer (Layer 4) in the OSI model is responsible for providing end-to-end communication services for applications.
This Layer is the first one which breaks the information data, supplied by Application layer in to smaller units called segments. It numbers every byte in the segment and maintains their accounting.
This layer ensures that data must be received in the same sequence in which it was sent.
This layer provides end-to-end delivery of data between hosts which may or may not belong to the same subnet.
All server processes intend to communicate over the network are equipped with well-known Transport Service Access Points (TSAPs) also known as port numbers.
The Transport Layer can work with different transport protocols, each offering different levels of reliability and control. Common protocols include TCP (Transmission Control Protocol) and UDP (User Datagram Protocol).
Let’s explore the key topics related to the Transport Layer in detail.
1. Transport Layer Service:
Reliability: Ensures data is delivered without loss, duplication, or errors. Protocols like TCP provide acknowledgment mechanisms and retransmissions to guarantee reliable communication.
Flow Control: Manages the rate at which data is sent to prevent overwhelming the receiver. This is achieved through mechanisms such as the Sliding Window Protocol, which dynamically adjusts the flow based on network conditions.
Error Control: Detects and corrects errors in transmitted data using techniques like checksums, acknowledgments, and retransmissions. For instance, TCP retransmits packets that are lost or corrupted during transmission.
Segmentation and Reassembly: Large messages are broken into smaller segments that can be transmitted efficiently over the network. These segments are reassembled in the correct order at the receiving end.
End-to-End Communication: A process on one host identifies its peer host on a remote network using Transport Service Access Points (TSAPs), commonly known as Port numbers. These predefined port numbers allow the transport service to deliver data to the correct application. Examples:
A DHCP client communicates with a DHCP server by sending requests to port 67.
Multiplexing and Demultiplexing: Enables multiple applications to use the network simultaneously by assigning unique port numbers to each application. This ensures that data packets are directed to the appropriate process.
Connection-Oriented vs. Connectionless Communication:
Connection-Oriented Communication (e.g., TCP): Ensures a reliable connection is established before data transmission begins. It involves mechanisms like the three-way handshake for setup and a FIN/ACK exchange for termination.
Connectionless Communication (e.g., UDP): Sends data without establishing a connection, offering lower overhead and faster communication but with less reliability.
2. Transport Protocols
There are several transport protocols, but the two most commonly used are TCP and UDP:
TCP (Transmission Control Protocol):
Reliable and connection-oriented.
Establishes a connection before data transmission (called three-way handshake).
Ensures data arrives in order and retransmits lost packets.
Provides flow control and error control.
Used for applications that require high reliability (e.g., HTTP, FTP, Telnet).
UDP (User Datagram Protocol):
Unreliable and connectionless.
Does not establish a connection before transmission and does not guarantee delivery or order.
Lower overhead compared to TCP, making it suitable for real-time applications (e.g., video streaming, online gaming, DNS).
3. Port and Socket
Port: A port is a 16-bit number used to uniquely identify a specific process or service on a host. It ensures that data is delivered to the correct application.
Well-known ports: Range from
0-1023
(e.g., HTTP uses port80
, HTTPS uses port443
).Registered ports: Range from
1024-49151
.Dynamic or private ports: Range from
49152-65535
.
Socket: A socket is a combination of an IP address and a port number, which uniquely identifies a network connection on a device. It is used by applications to send and receive data over the network.
A socket is represented by the format
IP address:port
.
4. Connection Establishment & Release
Connection Establishment (TCP):
Three-Way Handshake: TCP uses a three-step process to establish a connection between the sender and receiver.
SYN: The client sends a synchronization (SYN) request to the server.
SYN-ACK: The server responds with a synchronization acknowledgment (SYN-ACK).
ACK: The client acknowledges the server’s response, completing the handshake.
After the handshake, the connection is established, and data can be sent.
Connection Release (TCP):
Four-Way Handshake: When the communication ends, TCP uses a four-step process to terminate the connection.
FIN: The client sends a finish (FIN) request to the server.
ACK: The server acknowledges the FIN request.
FIN: The server sends its own FIN request.
ACK: The client acknowledges the server’s FIN request, and the connection is terminated.
5. Flow Control & Buffering
Flow Control is the mechanism used to prevent the sender from overwhelming the receiver with too much data too quickly.
TCP Flow Control:
Sliding Window: TCP uses a sliding window to manage flow control. It allows the sender to send a certain amount of data before waiting for an acknowledgment. The window size is dynamically adjusted based on the receiver’s available buffer space.
Buffering:
Data is stored in buffers at both the sender and receiver ends. The sender buffers outgoing data before sending it, while the receiver buffers incoming data until it is processed.
6. Multiplexing & Demultiplexing
Multiplexing: This is the process of combining multiple data streams from different processes into a single stream for transmission over the network. Each data stream is given a unique port number at the sender’s side.
Demultiplexing: This is the reverse process where the receiver separates the combined data stream back into individual streams, using the destination port number to direct each packet to the correct process.
7. Congestion Control Algorithms
Congestion Control refers to the mechanisms used to avoid or control congestion in the network. Congestion occurs when the network or a router becomes overloaded with too much traffic.
TCP Congestion Control:
Slow Start: TCP starts by sending a small amount of data and increases the size of the congestion window exponentially as long as there is no congestion.
Congestion Avoidance: Once the congestion window reaches a threshold, the window size increases linearly.
Fast Retransmit and Fast Recovery: If a packet is lost, TCP retransmits the packet and then adjusts the congestion window to avoid further congestion.
Common Algorithms:
AIMD (Additive Increase/Multiplicative Decrease): The window size is increased additively when no congestion occurs and decreased multiplicatively when congestion is detected.
TCP Tahoe: A simple congestion control mechanism that includes slow start, congestion avoidance, and fast retransmit.
TCP Reno: A more advanced version of Tahoe, which includes fast recovery.
Conclusion
The Transport Layer ensures end-to-end communication, error handling, flow control, and multiplexing.
Transport Protocols like TCP provide reliable, connection-oriented communication, while UDP provides lightweight, connectionless communication.
Ports and Sockets allow the transport layer to address different processes on a host.
Connection Establishment and Release involves processes like the three-way handshake for establishing a TCP connection and the four-way handshake for releasing it.
Flow Control & Buffering help to manage the pace of data transmission.
Multiplexing & Demultiplexing ensure that data from different applications can be sent over a single network connection.
Congestion Control algorithms manage network congestion and ensure efficient data transmission even under heavy load.
Last updated