Discovering the meaning and purpose behind network ports.

When conducting network requests, the utilization of an IP address or a host name in conjunction with a port is essential.

To illustrate:

  • http://localhost:8080 (port 8080)
  • ftp://127.0.0.1:29392 (port 29392)

But what exactly is a port?

In networking, a port is a crucial concept that allows multiple applications to respond on the same computer within the same protocol.

For instance, it is possible to have two web servers running simultaneously on a single machine, each assigned to a different port.

One server might operate on the default port 80, typically reserved for web servers utilizing the HTTP protocol. However, the second server can be set up on any available port other than port 80. Common alternatives include ports 8080 or 81, for example.

When it comes to secure communication over the web, the default port for HTTPS is 443.

It is worth noting that every protocol has its own default port. However, programs are not restricted to utilizing those defaults. They have the freedom to choose any unused port within the range of 1 to 65535 (16-bit unsigned = 2^16). For a comprehensive compilation of default port numbers associated with TCP and UDP-based protocols, consult the list of default port numbers.

In historical terms:

  • FTP uses port 21
  • Telnet uses port 23
  • SMTP uses port 25
  • POP3 uses port 110

Although, it is now recommended to use their respective secure counterparts that operate on alternative ports.