Skip to content
Home » Multiplexing and Demultiplexing in Transport Layer

Multiplexing and Demultiplexing in Transport Layer

1. Introduction

Multiplexing and demultiplexing are important functions of the Transport Layer.

A computer usually runs many applications at the same time. For example:

  • Web browser
  • Email
  • YouTube
  • WhatsApp/Web applications
  • File transfer

All these applications need to communicate through the network.

The Transport Layer uses port numbers to identify different applications and manage their data.

Multiplexing = Many applications → One network connection
Demultiplexing = Network data → Correct application


2. Multiplexing

Definition

Multiplexing is the process of collecting data from multiple applications running on a host and sending it through the network using the Transport Layer.

In simple words:

Multiplexing combines data from different applications for transmission.

Diagram

       APPLICATIONS
           
   Web Browser
       │
   Email App
       │
   File Transfer
       │
   Video App
       │
       ↓
┌─────────────────────┐
│  TRANSPORT LAYER    │
│    MULTIPLEXING     │
└──────────┬──────────┘
           ↓
        NETWORK

3. Role of Port Numbers in Multiplexing

Each application uses a port number.

For example:

Web Server       → Port 80
HTTPS            → Port 443
FTP              → Port 21
DNS              → Port 53

When an application sends data, the Transport Layer adds information such as the source port and destination port.

For TCP/UDP communication, the transport header contains port numbers.

Example

Suppose your computer is running:

Browser → Source Port 50001
Email   → Source Port 50002
FTP     → Source Port 50003

The Transport Layer can distinguish these communications using their port information.


4. Demultiplexing

Definition

Demultiplexing is the process of receiving data from the network and delivering it to the correct application or process.

In simple words:

Demultiplexing separates incoming data and delivers it to the appropriate application.

Diagram

                 NETWORK
                    │
                    ↓
        ┌─────────────────────┐
        │  TRANSPORT LAYER    │
        │   DEMULTIPLEXING    │
        └──────────┬──────────┘
                   │
        ┌──────────┼──────────┐
        ↓          ↓          ↓
     Browser     Email       FTP

5. How Multiplexing Works

Suppose a computer has three applications:

Browser
Email
FTP

Step 1

Each application generates data.

Browser → Data A
Email   → Data B
FTP     → Data C

Step 2

The Transport Layer receives all these data streams.

Step 3

The Transport Layer adds a transport header containing port information.

Browser Data + Port Information
Email Data   + Port Information
FTP Data     + Port Information

Step 4

The data is passed to the Internet/Network layer for transmission.

Applications
     ↓
Transport Layer
     ↓
Internet Layer
     ↓
Network

This process is called multiplexing.


6. How Demultiplexing Works

At the receiving computer:

Step 1

Data arrives from the network.

Step 2

The Internet Layer passes the data to the Transport Layer.

Step 3

The Transport Layer examines the destination port number and other connection information.

Step 4

It delivers the data to the appropriate application.

              Incoming Data
                    ↓
            Transport Layer
                    ↓
        Check Port Information
                    ↓
       ┌────────────┼────────────┐
       ↓            ↓            ↓
    Port 80      Port 25      Port 21
       ↓            ↓            ↓
    Browser       Email         FTP

This process is called demultiplexing.


7. Simple Real-Life Example

Imagine a post office.

Many people send letters through the same postal system.

Person A ──┐
Person B ──┼──→ Post Office → Transport Network
Person C ──┘

The postal system combines the letters for transportation.

This is similar to multiplexing.

At the destination, the postal system reads the address and delivers each letter to the correct person.

This is similar to demultiplexing.

Multiplexing = Collect and send
Demultiplexing = Identify and deliver


8. Example with Web Browsing

Suppose you are using your computer for:

  1. Web browsing
  2. Email
  3. DNS query

At the sender:

Browser
   ↓
Port 50001
   ↓
Transport Layer
Email
   ↓
Port 50002
   ↓
Transport Layer
DNS
   ↓
Port 50003
   ↓
Transport Layer

The Transport Layer manages these different communications and sends them through the network.

At the receiver, port information helps deliver the data to the correct process.


9. Multiplexing in TCP and UDP

Both TCP and UDP support multiplexing and demultiplexing.

UDP

UDP mainly uses:

  • Source port
  • Destination port

to identify the communication.

TCP

TCP uses a more complete connection identification based on:

  • Source IP address
  • Source port
  • Destination IP address
  • Destination port

This combination is commonly called a:

4-tuple

Example:

Source IP       : 192.168.1.10
Source Port     : 50001
Destination IP  : 93.184.216.34
Destination Port: 443

This helps TCP distinguish different connections.


10. Multiplexing vs Demultiplexing

MultiplexingDemultiplexing
Takes data from multiple applicationsReceives incoming data
Combines/manages multiple data streamsSeparates incoming data
Occurs at sender sideOccurs at receiver side
Uses port numbersUses port/connection information
Application → TransportTransport → Application
Many → One network pathOne incoming flow → Correct process

Easy diagram

        MULTIPLEXING

App 1 ──┐
App 2 ──┼──→ Transport → Network
App 3 ──┘


        DEMULTIPLEXING

Network → Transport ──┬──→ App 1
                      ├──→ App 2
                      └──→ App 3

11. Why Multiplexing and Demultiplexing are Important

1. Multiple applications can work simultaneously

A computer can browse the web while downloading a file and receiving email.

2. Efficient network usage

Many application data streams can use the same network infrastructure.

3. Correct delivery

Demultiplexing ensures that data reaches the correct application.

4. Process-to-process communication

The Transport Layer provides communication between specific applications/processes rather than merely between computers.

5. Port-based identification

Port numbers help identify different services and applications.


12. Important Terms

Port Number

A number used to identify a network service or process.

Socket

A socket is commonly represented by:

IP Address + Port Number

Example:

192.168.1.10 : 50001

Multiplexing

Many applications → Transport Layer → Network

Demultiplexing

Network → Transport Layer → Correct application


13. Exam Diagram

                    SENDER
                      
   ┌─────────┐
   │ Browser │───┐
   └─────────┘   │
   ┌─────────┐   │
   │  Email  │───┼──→ MULTIPLEXING
   └─────────┘   │          │
   ┌─────────┐   │          ↓
   │   FTP   │───┘       NETWORK
   └─────────┘              │
                            ↓
                      DEMULTIPLEXING
                            │
                 ┌──────────┼──────────┐
                 ↓          ↓          ↓
              Browser     Email       FTP
                      
                    RECEIVER

14. Quick Revision

Multiplexing

Collecting data from multiple applications and sending it through the network.

Demultiplexing

Receiving network data and delivering it to the correct application.

Main identifier

Port Number

Remember

MULTIPLEXING
Many Applications
       ↓
Transport Layer
       ↓
Network


DEMULTIPLEXING
Network
   ↓
Transport Layer
   ↓
Correct Application

One-line memory trick

Multiplexing = Many to One
Demultiplexing = One to Many

For a 10-mark answer, draw the sender–network–receiver diagram and explain the role of port numbers.