Port

There are 2^16 ports (0 to 65,535).

0-1023 are reserved for system ports. Should NOT be used by user level processes.

Standard ports:

  • 22: Secure Shell
  • 53: DNS Lookup
  • 80: HTTP
  • 443: HTTPs

Special ports

Port '0' (Zero)

Tells the operating system to assign a random available ephemeral port.

Use cases: Tests

This is the best practice for tests when port is needed for running tests as it prevents port collisions between parallel test runs or other applications.

Use case: Flexible port

If your application does not require a stable port this is quite convinient to be able to stand up the app without experiencing issues due to clashes.