What is the largest TCP/IP network port number allowable for IPv4?

前端 未结 8 1574
走了就别回头了
走了就别回头了 2020-11-29 16:19

What is the highest port number one can use?

8条回答
  •  星月不相逢
    2020-11-29 16:41

    Valid numbers for ports are: 0 to 2^16-1 = 0 to 65535
    That is because a port number is 16 bit length.

    However ports are divided into:
    Well-known ports: 0 to 1023 (used for system services e.g. HTTP, FTP, SSH, DHCP ...)
    Registered/user ports: 1024 to 49151 (you can use it for your server, but be careful some famous applications: like Microsoft SQL Server database management system (MSSQL) server or Apache Derby Network Server are already taking from this range i.e. it is not recommended to assign the port of MSSQL to your server otherwise if MSSQL is running then your server most probably will not run because of port conflict )
    Dynamic/private ports: 49152 to 65535. (not used for the servers rather the clients e.g. in NATing service)

    In programming you can use any numbers 0 to 65535 for your server, however you should stick to the ranges mentioned above, otherwise some system services or some applications will not run because of port conflict.
    Check the list of most ports here: https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers

提交回复
热议问题