Obviously, the most common use of the word port refers to shipping.

Computing, however, also uses the term port.

In fact, it has two uses.

Article image

The first refers to the socket into which a cable can be plugged.

Typical examples would include a USB or ethernet port.

Technically, an ethernet socket could be thought of as a networking port.

That is not the accepted meaning of the word port in networking.

Contents

Why Are Port Numbers Necessary?

This lets the server know to which IP address it needs to send the response.

This works fine in an idealized system with one piece of software making and receiving connection traffic.

The real world isnt like that, though.

In any computer, there is a range of software making web link traffic.

One final addressing layer is used the port number.

Imagine having a web net net app with two tabs open and an online video game simultaneously.

Each internet tool tab must be able to send and receive data pipe traffic, potentially simultaneously.

The online game also needs to both send and receive web connection traffic.

The same also works for servers.

Suppose you have a server that runs both a webserver and an email server.

What Are Port Numbers?

Port numbers take the form of a 16-bit unsigned integer.

This allows 65536 possible port numbers ranging from 0 to 65535.

There is no physical port system.

The entire addressing scheme, like with IP addresses and MAC addresses, is entirely logical.

Within the port number space, there is some other structure.

Port number 0 is reserved.

In TCP traffic, 0 is entirely unused.

In UDP traffic, the port number is optional, with a port of 0 meaning no port.

This works for UDP because its a stateless protocol that doesnt necessarily expect a response.

TCP and UDPs ports are separate.

One service can bind to one or more ports on one or both protocols.

Services that use both typically attach to the same port numbers in TCP and UDP.

Ports 1-1023 are known as well-known ports and generally require administrative permissions to bind to.

Some well-known ports are 80 for HTTP, 443 for HTTPS, and 53 for DNS.

Next, youve got the range 1024 49151.

These are known as the registered ports.

Ports between 49152 and 65535 are known as ephemeral ports.

As mentioned above, port numbers below 1024 tend to require administrative or root permissions to bind to.

A listener is a port that is opened and left open.

It listens for messages so it can process them and send a reply.

This is almost exclusively the behavior of server-jot down services such as a web server.

Standard port numbers for utility listeners mean that its easy to know how to actually connect to a service.

In some cases, listeners will be set up on alternate ports.

This may be because another service or version of the service s already using the standard port.

It may also be an attempt at security through obscurity.

Conclusion

A connection port is a logical address.

Port numbers range from 0 to 65535.

Many services are associated with a standard port number.

The servers use these ports, while devices connecting to them use random high number ports.