Current location - Quotes Website - Collection of slogans - What are local address, local port number, remote address and remote port number?
What are local address, local port number, remote address and remote port number?
Local address: an IP address assigned by DHCP or manually set, usually a private network address.

Local port number: ports corresponding to common services: FTP: 23, Telnet: 23, SMTP: 25, DNS: 53, Sina.com, etc. There is a certain correspondence between IP and domain name. If the IP address is similar to the ID number, then the domain name is your name. Hosts with IP addresses 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".

In fact, only IP addresses can be used for data transmission in the network, so before transmission, domain names need to be converted into IP, which is specially done by a server called DNS. So in network programming, you can use IP or domain name to identify a device on the network.

In order to run multiple programs on one device, the concept of port is artificially designed, and similar examples include some extension numbers in the company. It is stipulated that a device has 2 16 ports, that is, 65536 ports, and each port corresponds to a unique program. Each network program, whether client or server, corresponds to one or more specific port numbers. Because the range of 0- 1024 is mostly occupied by the operating system, the port number after 1024 is generally used in actual programming.

The following are the ports corresponding to some common services: FTP: 23, Telnet: 23, SMTP: 25, DNS: 53, http: 80, https:443.

Using the port number, you can find the unique program on the device. So if you need to establish a connection with a computer, you only need to know the IP address or domain name, but if you want to exchange data with a program on the computer, you must also know the port number used by the program.