Port numbers are integers in the range 1-65535 used to distinguish between different services offered by a given machine on the internet. Each internet machine has one space of 65535 port numbers for TCP connections and a second, separate space of 65535 port numbers for UDP connections.
These port numbers form the only way of distinguishing between different processes or users on the same machine using the UDP and TCP Internet protocols: An internet IP address (22.214.171.124, say) plus a port number form the most specific Internet address these protocols understand.
Every process communicating over the Internet via these protocols must have at least one port number assigned to it. A process which is communicating simultaneously with many other processes may have dozens or even hundreds of port numbers assigned to it.
Some port numbers have only temporary significance, being assigned for the duration of a program run. Port numbers assigned to a telnet or rlogin session are in this category. These numbers are called "ephemeral" and are usually picked arbitrarily by the operating system from the set of currently free port numbers.
Other port numbers have specific, widely understood meanings, which processes on other machines use to locate specific services. For example, 'sendmail' always runs on TCP port 25, and other systems count on this when sending mail. These numbers are called 'well-known' numbers, and the best established ones are published periodically: see http://ds.internic.net/rfc/rfc1700.txt (mirrored at http://sunsite.unc.edu/pub/docs/rfc/rfc1700.txt).
Certain ranges of port numbers have special significance.
In particular, ports 1-1023 (in both the TCP and UDP address spaces) are reserved for processes running with unix root privilege. This provides a certain (weak) amount of authentication: If you connect to a port in this range, you can have some confidence that the process you contact was set up by the authority controlling that machine, rather that by some arbitrary user.
Unix typically (but not always (9)) allocates ephemeral TCP ports from the range 1024-5000, and ephemeral UDP ports from the range 1024-32767. If your are picking a well-known port for a new service, you might want to avoid these ranges, in order to avoid finding yourself unable to restart your server due to (say) some telnet session having been assigned your port number.
In addition, it is best to avoid ports used by other well-known services, both to avoid confusion, and to avoid conflict should you wish to run one of those services on your machine at some point. For example, the X Window System uses TCP ports 6000-6063, which makes this an excellent port range to avoid.
Note that TCP ports in the range 10,000 -> 65,535 are almost entirely unused at present -- you don't have to try and squeeze into the crowded 5000-9999 range.
A reasonable choice for a new TCP port number for an in-db Muq daemon supporting local, experimental, or game functionality would be '2' followed by the last four digits of your phone number. This scatters them randomly, minimizing the chance of port-choice collisions, without depending on a central registration authority.
For production in-db Muq daemons which parallel the function of an existing unix daemon at port xyz, I suggest using port 30xyz: Port 30007 for echo, 30011 for systat listing of users, 30079 for finger, 30023 for telnet, 30025 for mail, 30080 for HTTP, &tc.
For production in-db Muq daemons not corresponding to an existing unix daemon, I suggest using ports 31000-31999, ideally registering them with some central coordinator.
For random test scripts connecting only to the local machine but needing a specific port, I suggest using ports 32000-32767.
When multiple Muq servers must export a full complement of daemons from the same IP address, I suggest the second use the range 32000-33999 in place of 30000-31999, the third use the range 34000-35999, and so forth.
Go to the first, previous, next, last section, table of contents.