Multiplexing and Demultiplexing at the Transport Layer

Multiplexing is the process of combining data from multiple applications into a single stream for transmission over the network. Let’s explain multiplexing and demultiplexing at the transport layer of the OSI model.

At the Sender’s Side:

  • A computer might be running multiple applications (e.g., browser, email, file transfer).
  • Each application sends data to the transport layer.
  • The transport layer adds headers (like port numbers) to each segment to identify the source application.
  • These segments are then passed to the network layer as one stream.

This allows many applications to share the same network connection (IP address).

What Is Demultiplexing?

Demultiplexing is the process of delivering the received data to the correct application based on the transport layer headers.

 At the Receiver’s Side

  • The transport layer receives segments from the network layer.
  • It checks the destination port number in each segment.
  • Based on the port number, it delivers the data to the correct application.

This ensures that the right application gets the right data.

Key Terms

Term Definition
Port Number A 16-bit identifier used to distinguish different applications on a device.
Socket A combination of IP address and port number (e.g., 192.168.1.5:80)
Segment A transport-layer data packet with headers (e.g., TCP segment, UDP datagram)

Example Scenario

Let’s say your computer is:

  • Browsing a website (HTTP, port 80)
  • Downloading a file (FTP, port 21)
  • Checking email (IMAP, port 143)

Multiplexing:

  • All three apps send data to the transport layer.

  • TCP or UDP adds unique source port numbers.

  • Data is sent to the network layer as a single stream.

Demultiplexing (on the server):

  • Server receives the data.

  • Based on destination port number, it sends the data to the correct server app (HTTP, FTP, IMAP).

 Summary Table

Function Where It Happens What It Does
Multiplexing Sender (Transport Layer) Combines data from multiple apps into one stream
Demultiplexing Receiver (Transport Layer) Uses port numbers to deliver data to the correct application

 Final Thought

Multiplexing and demultiplexing allow multiple apps to use the same network connection simultaneously without interfering with each other. It’s like sending multiple letters in one envelope and sorting them on arrival.