๐ค Why Do We Need Multiplexing & Demultiplexing?
A single device can run many applications at the same time:
๐ Web browser
๐ง Email client
๐ฎ Online game
๐ File download
๐ All these applications want to:
Send data โ
Receive data โ
Use the same network interface โ
๐ How is this possible without confusion?
๐ก Answer: Multiplexing & Demultiplexing
๐ง Simple Definitions
๐ Multiplexing
๐ Multiplexing is the process of combining data from multiple applications and sending it over the network through a single channel.
๐ Demultiplexing
๐ Demultiplexing is the process of receiving data from the network and delivering it to the correct application.
๐ง One-Line Understanding
๐ค Multiplexing โ Many โ One
๐ฅ Demultiplexing โ One โ Many
๐ง Real-Life Analogy (Very Easy to Remember)
๐ฎ Post Office Example
Many letters from different people โ Multiplexing
Post office sorts letters by address โ Demultiplexing
๐ Transport Layer works exactly the same way.
๐งญ Where Do Multiplexing & Demultiplexing Occur?

Performed at the Transport Layer
Uses:
Port numbers
IP addresses
Protocol (TCP/UDP)
๐ Network Layer does NOT handle applications.
๐ค Multiplexing (Sender Side)
๐ง What Happens at Sender?
1๏ธโฃ Multiple applications generate data
2๏ธโฃ Each application is assigned a port number
3๏ธโฃ Transport Layer:
Adds source & destination port
Creates segments
4๏ธโฃ Segments are passed to Network Layer
๐ All data flows through one network connection.
๐ง Example
Application | Source Port |
|---|---|
Browser | 52345 |
52346 | |
File Transfer | 52347 |
๐ Transport Layer multiplexes them.
๐ฅ Demultiplexing (Receiver Side)
๐ง What Happens at Receiver?
1๏ธโฃ Segments arrive from Network Layer
2๏ธโฃ Transport Layer reads:
Destination port number
3๏ธโฃ Data is delivered to:
Correct application
๐ Each application receives only its own data.
๐ง Example
Destination Port | Application |
|---|---|
80 | Web Server |
25 | Mail Server |
21 | FTP Server |
๐ Transport Layer demultiplexes data.
๐ Role of Ports in Multiplexing & Demultiplexing
๐ Ports are the key identifiers.
Without ports:
Data reaches device โ๏ธ
But not the correct application โ
๐ Ports solve this problem.
๐ง Multiplexing & Demultiplexing
๐น TCP Characteristics
Connection-oriented
Uses socket pairs
๐ TCP identifies a connection using:
(Source IP,Source Port, Destination IP, Destination Port)๐ This ensures:
Reliable delivery
Correct application mapping
๐น UDP Characteristics
Connectionless
Simpler demultiplexing
๐ UDP uses:
Destination port
Destination IP
๐ Faster but less strict.
โ๏ธ TCP vs UDP (Multiplexing Perspective)
Feature | TCP | UDP |
|---|---|---|
Connection | Required | Not required |
Identification | 4-tuple | Port-based |
Reliability | High | Low |
Complexity | High | Low |
๐ง Why Transport Layer Handles This (Not Network Layer)
Layer | Responsibility |
|---|---|
Network Layer | Deliver packet to correct device |
Transport Layer | Deliver data to correct application |
๐ Multiplexing & demultiplexing are application-level tasks.
๐ End-to-End View (Complete Picture)

1๏ธโฃ Application generates data
2๏ธโฃ Transport Layer multiplexes
3๏ธโฃ Network Layer routes
4๏ธโฃ Transport Layer demultiplexes
5๏ธโฃ Application receives data
๐ง Common Mistake to Avoid
โ Multiplexing is done by Network Layer
โ๏ธ Multiplexing is done by Transport Layer
โญ Advantages of Multiplexing & Demultiplexing
Efficient use of network
Supports multiple applications
Prevents data confusion
Enables multitasking
โญ Memory Trick
MULTIplexing โ MULTI apps โ One channel
DEmultiplexing โ DEliver to correct app
โญ One-Line Summary
๐น Multiplexing combines data from multiple applications, and demultiplexing delivers data to the correct application using port numbers.