web analytics

Multiplexing Using TCP Port Numbers

TCP and UDP both use a concept called multiplexing. Therefore, this section begins with
an explanation of multiplexing with TCP and UDP. Afterward, the unique features of TCP
are explored.

Multiplexing by TCP and UDP involves the process of how a computer thinks when receiving
data. The computer might be running many applications, such as a web browser, an
email package, or an Internet VoIP application (for example, Skype). TCP and UDP multiplexing
tells the receiving computer to which application to give the received data.

Some examples will help make the need for multiplexing obvious. The sample network consists
of two PCs, labeled Hannah and Jessie. Hannah uses an application that she wrote to
send advertisements that appear on Jessie’s screen. The application sends a new ad to Jessie
every 10 seconds. Hannah uses a second application, a wire-transfer application, to send
Jessie some money. Finally, Hannah uses a web browser to access the web server that runs
on Jessie’s PC. The ad application and wire-transfer application are imaginary, just for this
example. The web application works just like it would in real life.

Figure 5-2 shows the sample network, with Jessie running three applications:
■ A UDP-based advertisement application
■ A TCP-based wire-transfer application
■ A TCP web server application
Free CISCO CCNA Routing and Switching ICND1 Study Guide
Figure 5-2 Hannah Sending Packets to Jessie, with Three Applications

Jessie needs to know which application to give the data to, but all three packets are from
the same Ethernet and IP address. You might think that Jessie could look at whether the
packet contains a UDP or TCP header, but as you see in the figure, two applications (wire
transfer and web) are using TCP.

TCP and UDP solve this problem by using a port number field in the TCP or UDP header,
respectively. Each of Hannah’s TCP and UDP segments uses a different destination port
number so that Jessie knows which application to give the data to. Figure 5-3 shows an
example.
Free CISCO CCNA Routing and Switching ICND1 Study Guide

Figure 5-3 Hannah Sending Packets to Jessie, with Three Applications Using Port Numbers to Multiplex

Multiplexing relies on a concept called a socket. A socket consists of three things:
■ An IP address
■ A transport protocol
■ A port number

So, for a web server application on Jessie, the socket would be (10.1.1.2, TCP, port 80)
because, by default, web servers use the well-known port 80. When Hannah’s web browser
connects to the web server, Hannah uses a socket as well—possibly one like this: (10.1.1.1,
TCP, 1030). Why 1030? Well, Hannah just needs a port number that is unique on Hannah,
so Hannah sees that port 1030 is available and uses it. In fact, hosts typically allocate
dynamic port numbers starting at 1024 because the ports below 1024 are reserved for wellknown
applications.

In Figure 5-3, Hannah and Jessie use three applications at the same time—hence, three
socket connections are open. Because a socket on a single computer should be unique, a
connection between two sockets should identify a unique connection between two computers.
This uniqueness means that you can use multiple applications at the same time, talking
to applications running on the same or different computers. Multiplexing, based on sockets,
ensures that the data is delivered to the correct applications. Figure 5-4 shows the three
socket connections between Hannah and Jessie.

Free CISCO CCNA Routing and Switching ICND1 Study Guide
Figure 5-4 Connections Between Sockets

Port numbers are a vital part of the socket concept. Well-known port numbers are used by
servers; other port numbers are used by clients. Applications that provide a service, such
as FTP, Telnet, and web servers, open a socket using a well-known port and listen for connection
requests. Because these connection requests from clients are required to include
both the source and destination port numbers, the port numbers used by the servers must
be well-known. Therefore, each service uses a specific well-known port number. The wellknown
ports are listed at www.iana.org/assignments/service-names-port-numbers/servicenames-
port-numbers.txt.

On client machines, where the requests originate, any locally unused port number can be
allocated. The result is that each client on the same host uses a different port number, but
a server uses the same port number for all connections. For example, 100 web browsers on
the same host computer could each connect to a web server, but the web server with 100
clients connected to it would have only one socket and, therefore, only one port number
(port 80, in this case). The server can tell which packets are sent from which of the 100 clients
by looking at the source port of received TCP segments. The server can send data to
the correct web client (browser) by sending data to that same port number listed as a destination
port. The combination of source and destination sockets allows all participating hosts
to distinguish between the data’s source and destination. Although the example explains the
concept using 100 TCP connections, the same port-numbering concept applies to UDP sessions
in the same way.

Subscribe To Get

Latest IT certification News 

Help You Pass Any IT Exam