Multiplexing & Demultiplexing
These notes are low-effort, due to catching up in this module. See the videos and slides for more detail.
Demultiplexing
Each IP datagram carries the source and destination IP address and a transport-layer segment. This segment includes:
- Source Port
- Destination Port
- Other Header Fields
- Application Data
Connection-less Demultiplexing
This is used by UDP. To create a socket you can use the following Java code:
DatagramSocket socketName = new DatagramSocket(12345);
IP/UDP datagrams with same destination port #, but different source IP addresses and/or source port numbers will be directed to same socket at receiving host.
Connection-Oriented Demultiplexing
TCP socket is identified by a 4-tuple:
- Source IP Address
- Source Port Number
- Destination IP Address
- Destination Port Number
The receiver uses all four values (4-tuple) to direct the segment to the appropriate socket.
Server may support many simultaneous TCP sockets:
- Each socket is identified by its own 4-tuple.
- Each socket is associated with a different connecting client.
Differences
- UDP - Demultiplexing using destination port number (only).
- TCP - Demultiplexing using 4-tuple: source and destination IP addresses, and port numbers.