Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I mean the port to connecting.. just like SSH port, nginx port, etc.

Im not clear about the port. So far I can see port running not more than 5 characters (port xxxxx).

So, when choosing port number, what is the rules and the character limit of port? Is 5 characters the maximum?


share|improve this question

There isn't a character limit to the number of ports, in TCP the port number is stored in an unsigned int, so that would give you a maximum value of 65535. you can use any port number from 0-65535. However, the first 1024 ports (also known as well-known ports) are reserved and generally can only be opened by root or Administrator accounts. Anything above 1024 is free game as long as you have ascertained that it is not being used by another process on the box.

share|improve this answer
The range should be 1-65535. Port 0 is "reserved" and you may not be able to bind to it depending on your OS. – Gerald Combs Apr 2 '10 at 17:00
@Gerald: Just because a port is reserved does not mean it is not part of the range, using that logic the range should be 1025-65535 because the lower 1024 ports are reserved for allocation by IANA. – Zypher Apr 2 '10 at 17:18
By "reserved" I mean "generally not usable at all". This is different from "requires root". – Gerald Combs Apr 2 '10 at 18:36
@Gerald: Gotcha – Zypher Apr 2 '10 at 18:38

From Wikipedia: A port number is a 16-bit unsigned integer, thus ranging from 0 to 65535. Please refer to this listing of common port usage.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.