Ports – addresses for programs

IP addresses are addresses that are assigned to computers and which can be compared to street addresses. If you want to send a letter to somebody then you would print down your message on a piece of paper. Then you would put the paper in an envelope, put the address of the receiver on the envelope and finally send it off. If a program on a computer wants to talk with a server, then the message is prepared by the program, and then the OS will put the message in a packet and send the packet to the IP address of the server.

But several people could share a single street address. Maybe a whole family lives in the same house. Often you don’t want to address the whole household with your letter but rather a single person living in that household. So a letter is normally also addressed to one specific person living at the address.

In a similar fashion, a single server can run multiple services or programs at the same time. For example, the server could run a Web Service, a DNS Service, an FTP Service and many other services. All of those services could be running simultaneously. And since they are running on a single server they also share the single IP address that the server is configured with.

So the server must have a way to know which service that each packet is meant for so that it can look at incoming data traffic and hand over the traffic to the correct service.

The solution that is used in network communication is something called Ports. These ports are used to give addresses to different services.

A service is really just a program like any other, except that a service is usually a program that is constantly running in the background on the computer. There are many examples of services.

Some are more obvious, such as a Web Server program that is serving Web Pages to people who are browsing in their Web Browser to the computer.

Others are more hidden and might be included in other programs or even the OS that you have installed. For example, Windows is running a Windows Update service in the background, which will look for new updates for your computer every now and then, and might prompt you to install any updates.

A computer can manage just fine with a single IP address, but it can listen on many ports simultaneously. Each program that wants to be able to receive network connections and data packets will require its own unique port.

The programs and services that you start on a computer will tell the OS (Windows, Mac OS X etc) which ports that the service would like to listen to. The OS will then start listening for traffic to that port, and if any such traffic arrives at the computer then the OS will forward that traffic to the correct program.

Program asks OS to forward port 80/TCP


There are Internet standards that determine which ports that common programs and services should use. This makes it a bit easier to know which ports that different services are probably using. A web server for example almost always listens for traffic on port 80, and a secure Web Server listens on port 443.

Here is a table showing a few examples of Ports that some common programs can listen to:

Table showing common ports and programs

The table above also displays two different so-called Protocols that different services use, TCP and UDP. Those protocols will be discussed in the next section.

Previous part:
Address translation

Next part:
UDP and TCP, two ways of sending traffic