seegongsik
Networks

What is a network port

The IP address found which computer to go to. But inside that computer, many apps run together: a web browser, mail, a game. Which of them should an arriving packet go to? That is what a port decides.

01

The IP Is the Building, the Port Is the Room

We met IP addresses earlier; an IP address finds which computer. But a computer is not a one-room house. It is more like a big building with many rooms.
A different app lives in each room, so finding the building is not enough. To arrive exactly, you also need to know which room inside. That room number is the port.

Tap the building to open the rooms inside

Tap the building (computer) to open the rooms inside. One building has several rooms, and each room has a port number.

Opening the building revealed a row of rooms. From outside there is only one building, and the IP address points to that one building.
Inside, though, it is divided into several rooms. Same building, different rooms. So the exact destination is the building's address plus the room number: IP address plus port number. That pair pins down a single app.

02

One Computer, Many Doors

Picture your own computer. You search the web in a browser while mail comes and goes and music plays. All these apps live together inside the same computer.
So they all have the same IP address. They still do not get mixed up, because each app has its own room: its own port.

IP address203.0.113.5
Tap an app to see the port it uses

Tap each app inside one computer (same IP) to see the port number it uses. The address is the same for all three; only the port differs from app to app.

Tapping the apps showed that the IP address was the same for all of them, which makes sense, since they live in the same building. But the port number was different for each app.
The browser uses the browser's room and mail uses the mail room. By splitting up the rooms like this, many apps can work on one computer without getting mixed up. So can any room number be used at all?

03

There Are Well-Known Numbers

A big building usually has fixed room numbers for places people often look for, like the front desk or the mail room, so that even first-time visitors can find them straight away.
Ports are the same. Widely used services have well-known room numbers agreed in advance: 80 for the web, 443 for the secure web (HTTPS), and so on.

Tap a well-known port to see which app's room it is

Tap the well-known ports one by one to see which service each room belongs to. Numbers such as web=80 and secure web (HTTPS)=443 are agreed in advance.

We tapped the well-known numbers one at a time: 80 is the web, 443 is the secure web. The number alone tells you whose room it is.
Thanks to these agreed numbers, you never have to type a port into the address bar; the browser goes to the right room on the web server by itself.
Strictly speaking, these well-known numbers are the server's rooms. The browser on your computer takes a temporary room number each time it connects, and the reply comes back to that temporary room.

04

Which App Should It Go To?

Now suppose a packet arrives. Using the IP address, it found its way to the building (computer). But there are several rooms in the building. Which room should the packet go into?
No need to worry: the packet also carries a port number, so it just slips into the room with that number, that is, the right app.

To203.0.113.5:80
Read the packet's port number, then tap the matching room (app) to deliver

Read the port number on the arriving packet, then tap the room (app) with the same number to deliver it. Tap another room and you are told the number does not match.

Tapping the room that matched the port number delivered the packet to the right app. Tapping another room failed, because the number did not match.
That is what a port does. The IP address takes the packet to the building, and the port number takes it to the room inside. Only together do they bring the packet to its real destination: one particular app.

05

Summing Up

In one line: the IP address finds the building (computer), and the port points to a room inside it, that is, an app. So the exact destination is IP address plus port number.
There are also well-known room numbers, like 80 for the web and 443 for the secure web. An arriving packet looks at the port number and goes to the right app: find the building, then find the room inside.

Tap the key points in order to review

Tap the key points in order and they light up one by one. (IP is the building, port is the room → many apps on one computer → well-known numbers → route by port to the right app) When all four are lit, the review is done.

Now you know how a packet finds not just the right computer but the right app: the IP address finds the building, and the port number finds the room.
But at home, the phones, laptops, and TV often share a single address as seen from outside. With only one address, how does a reply find its way back to the right device? The next lesson is about how a home router lets many devices share one address.

In one lineThe IP address finds the building (computer). But one building holds many rooms, that is, many apps, and a room number is a port. So the exact destination is "IP address + port number." Frequently used services have well-known room numbers: 80 for the web, 443 for the secure web (HTTPS). An arriving packet looks at its port number and goes into the room with that number, the right app.
← Networks
Was this helpful? Support seegongsik