Multiplexing and Demultiplexing in the Transport Layer
Multiplexing and Demultiplexing in the Transport Layer
Introduction
One of the important functions of the Transport Layer is to support communication between multiple application processes running simultaneously on a computer. This is achieved through two complementary operations:
- Multiplexing – Performed at the sender.
- Demultiplexing – Performed at the receiver.
These mechanisms enable many applications to share the same network connection efficiently while ensuring that each message reaches the correct application process.
What is Multiplexing?
Definition
Multiplexing is the process by which the Transport Layer accepts data from multiple application processes, adds the appropriate transport-layer information (such as port numbers), and combines them into transport-layer packets for transmission through the network.
It is called many-to-one communication because many application processes send their data to a single transport layer.
Working of Multiplexing
Suppose a user is simultaneously:
- Browsing the web
- Sending an email
- Downloading a file
Each application generates its own data.
The transport layer receives all these messages, adds the appropriate source and destination port numbers, and forwards them one by one to the network layer.
Diagram
Application Layer Web Browser (HTTP) │ Email Client (SMTP) │ FTP Client │ DNS Client │ ▼ ------------------- Transport Layer (Multiplexing) ------------------- │ ▼ Network Layer
Here, many application processes share a single transport layer.
Example of Multiplexing
Consider a user performing three tasks simultaneously:
| Application | Source Port | Destination Port |
|---|---|---|
| Web Browser | 52000 | 80 |
| Email Client | 53000 | 25 |
| FTP Client | 54000 | 21 |
The transport layer creates three transport packets.
Packet 1 Src Port = 52000 Dest Port = 80 Data = HTTP Request Packet 2 Src Port = 53000 Dest Port = 25 Data = Email Packet 3 Src Port = 54000 Dest Port = 21 Data = FTP Request
All three packets are then sent through the same network interface.
Advantages of Multiplexing
- Multiple applications can communicate simultaneously.
- Efficient utilization of the network.
- Allows sharing of the same transport protocol.
- Reduces communication overhead.
What is Demultiplexing?
Definition
Demultiplexing is the reverse process of multiplexing. The Transport Layer receives packets from the network layer, examines the destination port number, and delivers each packet to the correct application process.
It is called one-to-many communication because one transport layer distributes packets to many application processes.
Working of Demultiplexing
At the receiver,
- The transport layer receives packets.
- It reads the destination port number.
- It identifies the appropriate application.
- It delivers the message to that application.
Diagram
Network Layer │ ▼ ------------------- Transport Layer (Demultiplexing) ------------------- │ │ │ ▼ ▼ ▼ Web Email FTP Server Server Server
Thus, the transport layer delivers each packet to its correct destination process.
Example of Demultiplexing
Suppose the destination computer receives three packets.
Packet 1 Destination Port = 80
Delivered to
HTTP Server
Packet 2 Destination Port = 25
Delivered to
SMTP Server
Packet 3 Destination Port = 21
Delivered to
FTP Server
The operating system uses the destination port number to identify the correct application.
Complete Multiplexing and Demultiplexing Process
Sender Computer Web Browser │ Email Client │ FTP Client │ ▼ ------------------------- | Transport Layer | | Multiplexing | ------------------------- │ ▼ Network Layer │ Internet │ ▼ Network Layer ------------------------- | Transport Layer | | Demultiplexing | ------------------------- │ │ │ ▼ ▼ ▼ Web Server Mail FTP Server Server Receiver Computer
Role of Port Numbers
Port numbers are the key to multiplexing and demultiplexing.
During Multiplexing
The transport layer adds:
- Source Port Number
- Destination Port Number
Example
Source Port = 52000 Destination Port = 80
During Demultiplexing
The transport layer examines:
Destination Port = 80
and delivers the packet to
HTTP Server
Without port numbers, the operating system would not know which application should receive the data.
Real-Life Analogy
Imagine a post office.
Multiplexing
Many people send letters to the post office.
Person A Person B Person C │ ▼ Post Office
The post office collects all the letters and sends them through the transportation system.
This is similar to multiplexing.
Demultiplexing
At the destination city,
Post Office │ ┌────┼─────┐ │ │ │ ▼ ▼ ▼ House A House B House C
The post office sorts the letters and delivers each one to the correct house.
This is similar to demultiplexing.
Multiplexing vs Demultiplexing
| Feature | Multiplexing | Demultiplexing |
|---|---|---|
| Meaning | Many processes send data to one transport layer | One transport layer delivers data to many processes |
| Communication | Many-to-One | One-to-Many |
| Performed At | Sender | Receiver |
| Purpose | Collect data from multiple applications | Deliver data to the correct application |
| Uses Port Numbers | Adds source and destination port numbers | Examines destination port number |
Importance of Multiplexing and Demultiplexing
- Supports multitasking.
- Allows multiple applications to use the network simultaneously.
- Efficiently utilizes network resources.
- Enables process-to-process communication.
- Ensures data reaches the correct application.
- Essential for TCP and UDP communication.
Summary
- Multiplexing is the process by which the Transport Layer collects data from multiple application processes, adds transport-layer headers (including port numbers), and sends the packets to the network layer. It is a many-to-one operation.
- Demultiplexing is the reverse process, in which the Transport Layer receives packets from the network layer, examines the destination port number, and delivers each packet to the appropriate application process. It is a one-to-many operation.
- Together, multiplexing and demultiplexing enable multiple applications to communicate simultaneously over the same network while ensuring that each message is delivered to the correct destination process.

Comments
Post a Comment