In network technology, ports have two meanings: one is physical ports, such as interfaces used by ADSL modems, hubs, switches and routers to connect other network devices, such as RJ-45 ports and SC ports. The second is logical port, which generally refers to the port in TCP/IP protocol. Port numbers range from 0 to 65535, such as port 80 for browsing web services, port 2 1 for FTP services and so on. What I want to introduce here is the logical port.
So what does the port in TCP/IP protocol mean? If the IP address is compared to a house, the port is the door of the house. A real house has only a few doors, but an IP address can have 65536 ports! Ports are marked by port numbers, which are only integers from 0 to 65535.
What's the use of ports? As we know, a host with an IP address can provide many services, such as Web services, FTP services, SMTP services and so on. These services can be completely realized through 1 IP address. So, how does the host distinguish different network services? Obviously, you can't just rely on ip addresses, because IP addresses and network services have a one-to-many relationship. In fact, different services are distinguished by "IP address+port number".
It should be noted that the ports are not in one-to-one correspondence. For example, when your computer accesses the WWW server as a client, the WWW server uses the "80" port to communicate with your computer, but your computer may use the "3457" port.