WWW

How the Internet Works, Chapter 8
The Transport Layer: Application-Level Communication with Multiplexing, and Ports

posted in: How the Internet Works | 0

The Link and Internet layers handle transport of data between hosts. However, they do not have a way of differentiating between multiple applications communicating from a single host. Since we don’t want to send emails to browsers or web pages to email applications, we need application-level communication to differentiate between them.

Application-level communication uses multiplexing and ports to differentiate between applications.

Multiplexing and Demultiplexing

Multiplexing means combining a group of signals into one and sending them over a shared medium. Demultiplexing is doing the reverse. For example, a cable television has one cable with a single channel coming into a home. This cable has signals from all the different available channels multiplexed on it. The cable box demultiplexes the incoming signal (and does other things), and then sends the signal from the currently selected channel to the television.

Multiplexing as it applies to the Transport Layer works in a similar fashion. A stream of packets coming to a node’s IP address must send each packet to the right application. So each application using the network has its own channel. All the different application channels’ packets are multiplexed onto a carrier channel (a channel that carries multiplexed data). Then the carrier is transported to the receiving end and demultiplexed. Each individual packet is sent to the channel for the application that is using it.

These application channels are called ports.

Ports

A port is a channel reserved for the use of a single application on a single IP address. Transport Layer protocols support application-level communication by including a source port and destination port in their PDU header information.

A port is specified with a number of up to five digits (anywhere from 0 to 65535) following the IP address. In other words, the IP address and port have the format AAA.AAA.AAA.AAA:PPPPP, where A is the IP address and P is the port.

Port identifiers are divided into three types: well-known or system ports (0 to 1023), registered or user ports (1024 to 49151) and unregistered or dynamic ports (49152 to 65535). Port assignments are handled by the Internet Assigned Numbers Authority (IANA), which publishes a list of all assigned ports.

Well-Known Ports

Since a client initiates a request to a server, the client needs to know ahead of time which port to send the request to. This is the idea behind well-known ports: the client knows what port to send a request to without having to ask the server first. For example, HTTP requests to the world wide web are handled on port 80. HTTPS (secure HTTP) requests are handled on port 443. SMTP (Simple Mail Transfer Protocol) requests are handled on port 25.

Ephemeral Ports

On the other hand, since client requests can send the port number that they want the response to be sent to, the server doesn’t need to know ahead of time what port number to send its response to. Also, the port number doesn’t need to be permanently assigned to the client request, because once the data is transferred, the port number is no longer needed. So, the client sends the server a temporary port number from (usually) the dynamic range (49152 to 65535) that is not currently in use by a different process, and then listens on that port for the server’s response. When the data transfer between the server and the client is finished, the port number becomes available again.

These temporary port numbers are called ephemeral ports. The IANA guideline that ephemeral ports should be assigned from the dynamic range is not always adhered to, in part because the concept of ephemeral ports predates the guideline. So, older operating systems will vary from this. For example, Microsoft XP’s default range of ephemeral ports is 1024 to 5000.

Registered Ports

Registered ports are ports that are assigned to specific vendors for specific services. For example, IBM’s proprietary wireless LAN communicates on port 1461, and Blizzard’s World of Warcraft game traffic runs on port 3724.

The Transport Layer also addresses network reliability. The next article discusses reliability and how the most common Transport Layer protocol, TCP, addresses it.