The port number is the identifier for accessing the server. The client can find the corresponding server through the IP address, but the server has many ports. Each application corresponds to a port number. Only through a port number similar to the house number can the client truly access the server; in order to Ports are distinguished and each port is numbered. This is the port number. Ports are marked by port numbers, which are only integers ranging from 0 to 65535.
The operating environment of this tutorial: Windows 7 system, Dell G3 computer.
What is the port number?
The port number is the identifier for accessing the server.
Port number is just like a house number. The client can find the corresponding server through the IP address, but the server has many ports. Each application corresponds to a port number. Through a similar house number The port number allows the client to actually access the server. In order to distinguish the ports, each port is numbered, which is the port number.
Ports include two types: logical ports and physical ports:
Physical ports are used to connect interfaces between physical devices, such as ADSL Modem, hubs, switches, The interface on the router used to connect other network devices, such as RJ-45 port, SC port, etc.
Logical port refers to the port used to distinguish services in a logical sense, such as port 80 for browsing web services, port 21 for FTP services, etc. For example, the service port in the TCP/IP protocol distinguishes different services through different logical ports. The ports of an IP address are numbered using 16 bits, and can have up to 65536 ports.
Ports are marked by port numbers. Port numbers are only integers, ranging from 0 to 65535.
The role of the port number
The main role of the port number is to indicate what is provided by a specific process in a computer services. Computers in the network represent their identities through IP addresses. It can only represent a specific computer, but one computer can provide many services at the same time, such as database services, FTP services, Web services, etc. We use The port number is used to distinguish these different services provided by the same computer. For example, the common port number 21 represents the FTP service, the port number 23 represents the Telnet service, and the port number 25 refers to the SMTP service. The port number is generally a 4-digit integer. The port number cannot be repeated on the same computer. Otherwise, exceptions such as port number conflicts will occur
Usage rules
The port addresses in the TCP and UDP segment structures are both 16 bits, and can have port numbers in the range of 0---65535. There are the following usage regulations for these 65536 port numbers:
(1) Port numbers less than 256 are defined as common ports, and servers are generally identified by common port numbers. The services provided by any TCP/IP implementation use port numbers between 1---1023, which are managed by ICANN; the port numbers from 1024---49151 are registered ports and also become "user ports". Designated as a special service by IANA;
(2) The client only needs to ensure that the port number is unique on the local machine. The client port number is also called a temporary port number because it exists for a short time;
(3) Most TCP/IP implementations allocate port numbers between 1024---5000 to temporary port numbers. Port numbers greater than 5000 are reserved for other servers.
COMMON UNIX port numbers
The UNIX operating system is widely used because of its stable operation, low system requirements, and high security. Its Berkeley socket developed earlier and has distinctive features. For example, UNIX systems have the concept of reserved port numbers. Only a process with superuser privileges is allowed to assign itself a reserved port number. These port numbers range from 1 to 1023. Some applications use it as part of the authentication between the client and the server. Most TCP/IP implementations assign port numbers between 1024 and 5000 to ephemeral ports. Ports greater than 5000 are reserved for other servers (services that are not commonly used on the Internet)
For more related knowledge, please visit theFAQcolumn!
The above is the detailed content of What is the port number?. For more information, please follow other related articles on the PHP Chinese website!