1. Background introduction
What is a port?
On the Internet, each host sends and receives datagrams through TCP/TP protocol, and each datagram is routed according to the ip address of its destination host.
We know that most operating systems support multiple programs (processes) running at the same time, so which process should the destination host send the received datagram to?
Therefore, the port mechanism is introduced.
The local operating system will assign protocol ports to those processes that need them, and each protocol port is identified by a positive integer, such as 80,139,445, and so on.
After receiving the datagram, the destination host will send the data to the corresponding port according to the destination port number of the message header, and the process corresponding to this port will receive the data and wait for the arrival of the next group of data.
2. Knowledge analysis
Port classification? On the Internet, ports are divided into TCP ports and UDP ports according to protocol types.
Although they are all identified by positive integers, this will not cause ambiguity, such as port 80 of TCP and port 80 of UDP, because the datagram will indicate the port type and port.
In terms of port allocation, ports are divided into two categories: fixed ports (0- 1023): centralized management mechanism is adopted, that is, ports are allocated by a management organization, which is responsible for issuing these allocations.
Because these ports are bound with some services, we will often scan these ports to determine whether the other party has enabled these services, such as 2 1(ftp) and 80 (/login/113397829) of TCP.