Ports in Computer Networks

April 1, 2021 • Shannon Flynn


Not sure what ports in computer networks are? Ports are virtual locations within a device where connections start or end. A device’s operating system manages these ports, which are typically dedicated to a specific process or service. When a device needs to transmit or receive data, it will use one of these ports to do so.

This is why we use ports in computer networks — and what you need to know about ports when using your computer or setting up a local network.

What Do Ports Do in a Computer Network?

The use of ports simplifies data transfer and makes it easier for devices on the receiving end of a transmission to know what to do with a given piece of information. For example, you can use the File Transfer Protocol (FTP) on port 21 to send a file from one computer to another. 

Because the receiving computer has the port number you used to send the information, it knows what you’re sending and is able to receive the information and store it so that you’ll be able to use it.

Multiple ports also help computers send and receive different kinds of information at the same time. For example, even if you’re sending a file over port 21 to another computer on the network, that computer can still use the network with different port — for example, using the Hypertext Transfer Protocol Secure (HTTPS) to connect to the internet.

Ports are mostly a holdover from the early days of computer networking, as it became possible for computers to run more than one application at a time. To keep information organized, developers created ports to structure and manage the flow of data from computer to computer.

What Are the Different Port Numbers?

There are 65,535 total ports available for computers to use — but, in practice, just a fraction of these ports are in regular use. 

Most applications use a selection of common, well-known port numbers (specifically, ports 0 through 1023) — like ports 20 and 21 for FTP, port 80 for HTTP (or 443 for HTTPS) and port 194 for IRC.

Port Forwarding

Most of the time, assignment of traffic to different ports will be a fully automatic process. Even without your involvement, data will get from one device to another without much trouble.

Not every application can manage this on its own, however. In some instances, you may need to port forward to get an application working.

For example, maybe you’re away from home, but still forwarding your traffic through your home router. Some tools or applications may not know where to send the request as a result. In a case like this, you’ll need to use port forwarding to tell the application where to transfer that information.

After you’ve forwarded a port, it will be open to traffic from a specific IP address and port combination.

If you need to make your computer accessible to other computers, even if they’re connecting to yours via a router — which can happen if you’re trying to directly connect over the internet — port forwarding can also help. 

There are some other uses to port forwarding as well. You can use port forwarding to manage home web servers to ensure that some servers are easily accessible by outside parties, while others are limited to access requests originating from your home network.

The Importance of Switches in Computer Networks

Most of the time, knowing how ports work won’t be that important for connecting different devices — your network switches or router should handle most of the work. Still, ports are an essential concept to know if you want to be informed about computer networking.