Introduction to the Transport Layer
The transport layer provides logical communication between application processes running on different hosts. From an application's point of view, it's as if the processes are directly connected, even though they are separated by a complex network of routers and links.
Transport-layer protocols are implemented only in the end systems (e.g., computer, phone), not in the intermediate network routers.
Relation between Transport & Network Layer
The transport layer sits on top and builds upon the services of the network layer to provide more sophisticated communication.
Network Layer (IP):
- Provides host-to-host communication.
- Its job is to deliver packets, called datagrams, from one computer to another using IP addresses.
- It operates on a "best-effort" basis, meaning it doesn't guarantee delivery, order, or data integrity (unreliable service).
Transport Layer (TCP/UDP):
- Extends the host-to-host communication provided by IP to process-to-process communication.
- It ensures that data from an application on the sending host reaches the correct application on the receiving host.
- Transport-layer packets are generally called segments.
- It can also add services like reliability and congestion control.
The transport layer works only inside end systems (computers), not in routers which handles forwarding through the network.
Routers only operate up to the network layer, they forward packets based only on the destination IP address. They do not inspect the transport-layer information encapsulated within the datagram.
The network layer is the postal service that delivers a letter to a specific house (the host). The transport layer is the person at the house who reads the name on the envelope and gives it to the intended recipient (the application process).
Sockets and Port Numbers
Sockets: is a software interface and a unique identifier that is used by an application process to send and receive messages.
Port Numbers: A port number is a 16-bit value, ranging from 0 to 65535. Segment includes a source port number and a destination port number in its header to identify the correct socket.
- The range 0–1023 is reserved for well-known ports assigned to standard services (e.g., HTTP uses port 80, FTP uses port 21). These assignments are managed by the Internet Assigned Numbers Authority (IANA).
To differentiate between various running applications, the transport layer relies on sockets and port numbers. This mechanism ensures multiple applications (like HTTP, FTP, Telnet) can run simultaneously without mix-up.
Multiplexing and Demultiplexing
Multiplexing and demultiplexing are the transport layer's mechanisms for enabling process-to-process delivery. This allow a single host to run multiple network applications, like a web browser, a streaming service, and a game, all at the same time by gathering data from many applications and sending it over a single network link.
Multiplexing (At the Sender)
On the sending host, multiplexing is the process of gathering data from multiple application sockets (HTTP, FTP, Telnet), and encapsulating them for the network layer.
On the sending host, the transport layer performs these steps:
Receives data from an application processes.
Segments the data into smaller chunks.
Adds a transport-layer header to each chunk, creating a transport-layer segment. This header contains information like source and destination port numbers, which identify the specific application processes.
Passes the segments down to the network layer to be sent across the network over a single network link.
Demultiplexing (At the Receiver)
On the receiving host, demultiplexing is the process of delivering the data from an incoming transport-layer segment to the correct application socket.
On the receiving host, the process is reversed:
The network layer receives IP datagrams and extracts the transport-layer segments.
The transport layer examines the header of each segment to identify the destination port number to determine which socket (application process) should receive the data.
It then delivers the data from the segment to the correct application's socket.