0

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?

Thanks.

3 Answers 3

5

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.

4
  • The range should be 1-65535. Port 0 is "reserved" and you may not be able to bind to it depending on your OS. Apr 2, 2010 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, 2010 at 17:18
  • By "reserved" I mean "generally not usable at all". This is different from "requires root". Apr 2, 2010 at 18:36
  • @Gerald: Gotcha
    – Zypher
    Apr 2, 2010 at 18:38
4

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.

0

http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers

You must log in to answer this question.