ketan agrawal

multiplexing
Last modified on December 08, 2021

Links to “multiplexing”

How does the Internet work? (How does the Internet work? > IP addresses)

Every computer is given an address that’s 32 bits* long. This is known as its IP address.

IP addresses are a way to “multiplex” the scarce resource of the Internet – multiple machines can communicate over the Internet, because routers know how to deliver packets based on their destination address.

*Problem: only \(2^{32}\) = ~4 billion addresses in ipv4, which we have essentially run out of. Thus, ipv6 addresses were created that are 128 bits long.

E.g. the IP address 104.196.238.229 simply represents a 32-bit number, separated into each of its 4 bytes.

print('{0:b}'.format((104 << 24) + (196 << 16) + (238 << 8) + 229))
1101000110001001110111011100101

Here’s 127.0.0.1, aka localhost, in binary:

print('{0:b}'.format((127 << 24) + (0 << 16) + (0 << 8) + 1))
1111111000000000000000000000001

User Datagram Protocol (UDP) (User Datagram Protocol (UDP))

Problem: IP addresses only identify a machine. How does that machine know which application/program to deliver the packet to? We need another another layer of multiplexing, so that multiple applications on one computer can share one IP address.

This is where UDP comes in– we put something special, “User Datagram Protocol” (UDP) in the Protocol field of the datagram header – then in the UDP header, a nested header within the IP payload, a “port” that corresponds to a certain application. (TCP uses ports too!)

Applications such as Zoom which may not need the strict ordering/reliability of TCP may use UDP to create a custom protocol. E.g. Zoom uses UDP to deliver their packets.