optional · CSS study notes
Multiplexing In UDP and TCP
🧭
On this page — click any heading below to jump straight to it. ⬅️ Back to P-II.II. Computer Communications & Networks
OSI Layer: Transport Layer (L4)
Definition
- Multiplexing — gathering data from multiple application sockets at the sender, adding transport headers, and passing segments to the network layer
- Demultiplexing — delivering an arriving segment to the correct socket at the receiver using header fields
Requirements for Multiplexing
- Sockets must have unique identifiers
- Each segment must carry fields that identify the destination socket — the source port and destination port fields (16 bits each) present in both TCP and UDP headers
Connectionless (UDP) Demultiplexing
- A UDP socket is identified by a 2-tuple: destination IP address + destination port number
- Two datagrams with different source IPs/ports but the same destination IP and port are delivered to the same socket
- Source port serves as the return address for replies, not for demultiplexing
- Simpler and lighter — one socket can serve many clients
Connection-Oriented (TCP) Demultiplexing
- A TCP socket is identified by a 4-tuple: source IP, source port, destination IP, destination port
- Two segments with different source IPs or source ports are directed to different sockets
- Server maintains a welcoming (listening) socket plus a separate connection socket per client
- Enables thousands of simultaneous clients on a single well-known port (e.g., port 80)
Web Server Behaviour
- Non-persistent HTTP — a new socket per object requested, higher overhead
- Persistent HTTP — one connection reused for multiple objects
- High-performance servers use threads/processes per connection socket
Comparison
| Basis | UDP Demux | TCP Demux |
|---|---|---|
| Identifier | 2-tuple | 4-tuple |
| Sockets per server port | One shared | One per client connection |
| Connection state | None | Maintained per connection |
| Overhead | Low | Higher |
Numericals
Q1 — UDP socket count
Three clients (A, B, C) send datagrams to server IP 10.0.0.1, port 5000.
- UDP identifies by (10.0.0.1, 5000) only → 1 socket handles all three
Q2 — TCP socket count
Same three clients connect by TCP to 10.0.0.1:80.
- Each has a distinct 4-tuple → 3 connection sockets + 1 listening socket = 4 sockets
Q3 — Same host, two connections
Client 192.168.1.5 opens two browser tabs to the same server 10.0.0.1:80, using source ports 50123 and 50124.
- 4-tuples differ in source port → 2 distinct sockets; under UDP rules these would have collapsed into one
Q4 — Theoretical connection limit
One client IP to one server IP:port pair.
- Limited by available source ports ≈ 65,535 (practically ~16,000 ephemeral)
- Server side capacity is far larger because each different client IP creates new unique 4-tuples
CSS Exam Angle
- The single highest-value fact: UDP = 2-tuple, TCP = 4-tuple — state it explicitly and early
- Explain why a server can serve thousands of clients on one port; this is the practical payoff of 4-tuple demultiplexing
- Draw a diagram: application sockets above, one network connection below, ports acting as the routing key
Likely Questions
- Explain multiplexing and demultiplexing at the transport layer.
- How does TCP demultiplexing differ from UDP demultiplexing?
- How can one web server port serve thousands of simultaneous clients?
📜 Past-Paper Questions & Structured Answers
Questions are paraphrased; answer focus is suggested guidance, not an official marking scheme.
2018 · Paper-II · Q3(C) · 6 marks
Question (paraphrased): Explain transport multiplexing and demultiplexing.
Answer focus: Definitions, UDP/TCP socket selection and a worked endpoint example.
Multiplexing: a sending transport layer accepts data from several application sockets, adds transport headers including ports, and passes the units to IP. Demultiplexing: the receiver uses header information to deliver incoming data to the appropriate socket.
UDP: a typical unconnected server socket receives datagrams sent to its local IP/port from several clients. A connected UDP socket can additionally filter by peer.
TCP: established connections are distinguished by the four-tuple (source IP, source port, destination IP, destination port). A listening socket accepts separate connections that share the same server port.
Example: clients 192.0.2.10:51000 and 192.0.2.11:52000 connect to 198.51.100.20:443. The server’s two TCP connections are distinguishable even though both use port 443.
Sketch: App A + App B → sockets/ports → transport → IP; at the receiver, IP → transport lookup → correct application socket. This is process-level sharing, not FDM/TDM signal multiplexing.
2020 · Paper-II · Q5(c) · 7 marks
Question (paraphrased): Explain transport multiplexing/demultiplexing specifically for TCP/IP.
Answer focus: Six-mark explanation above plus encapsulation and reverse-delivery example.
Sender: applications write to sockets; TCP or UDP adds source/destination ports and passes segments/datagrams to IP. IP adds host addresses, so the network delivers to the host and transport selects the application.
Receiver: IP first identifies TCP or UDP using its protocol field. UDP commonly delivers by the destination local endpoint; TCP selects the established connection using both IP addresses and both ports.
Example: a browser at 192.0.2.10:51000 communicates with 198.51.100.20:443 while another application uses local port 52000. Replies to port 51000 reach the browser’s matching socket. On the server, many clients may connect to 443 simultaneously because each established four-tuple is different.
Diagram: browser / mail client → separate sockets → TCP/UDP headers → IP network → header lookup → correct receiver socket.
Importance: ports prevent data from different applications being confused; TCP connection identifiers additionally separate simultaneous sessions. Ports alone do not route a packet across the Internet.
2019 · Paper-II · Q5(a) · 8 marks
Question (paraphrased): Explain multiplexing techniques with suitable examples.
Answer focus: Definition, four techniques, operation/examples and comparison.
Multiplexing combines multiple channels onto a shared transmission medium; a demultiplexer separates them at the receiving end.
| Technique | Resource divided | Operation and example | Limitation |
|---|---|---|---|
| FDM | Frequency bands | Sources transmit simultaneously in distinct bands, e.g. broadcast radio or cable channels | Guard bands consume spectrum |
| TDM | Time slots | Sources alternate use of the link, e.g. digital telephony | Fixed slots may be idle |
| WDM | Optical wavelengths | Several optical carriers share one fibre, e.g. a fibre backbone | Requires optical transmitters/filters |
| CDM | Distinguishable spreading codes | Channels overlap in time and frequency but are separated through code correlation, e.g. CDMA systems | Interference and power control matter |
TDM variants: synchronous TDM reserves periodic slots; statistical TDM assigns opportunities to active sources and needs identification/buffering.
Worked illustration: four sources each producing 1 kbit/s require at least 4 kbit/s aggregate payload capacity, plus framing overhead. A simple synchronous frame could carry one bit from A, B, C and D in turn.
Selection: choose according to medium and equipment. FDM/WDM can carry digitally modulated information too; do not equate frequency or wavelength sharing with exclusively analogue data.
2025 · Paper-II · Q1 item 19 · 1 mark
Question: Which listed multiplexing method is the conventional choice for digital signals?
Answer: B — TDM, the intended textbook choice. It gives digital channels different time slots. FDM and WDM can also carry digital information on modulated carriers, so the option is not a universal physical restriction. Paper