- IPAddress Class Usage Examples:
Ipaddress.parse ("192.168.0.1")//Convert the IP address of type string to IPAddress instance
Ipaddress.loopback//Get a local loopback IP address, specifically 127.0.0.1
Ipaddress.broadcast//Get the address of the broadcast IP address, specifically 255.255.255.255
Ipaddress.any//Specific address is 0.0.0.0,Socket. The Bind method uses the any field to indicate that the Socket instance should listen for client activity on all network interfaces
- ipendpoint class contains the host and local or remote port information needed a application to connect to a service on a host. " The ipendpoint class contains the host and local or remote port information required by the application to connect to the service on the host, which uniquely determines the location of the program or process on the network
The specific application method is IPEndPoint (Ipaddress,port), IPAddress is the specific value of the IPAddress class mentioned above, port value network port number.
The port number is a two-byte integer, so the value range is 0~65535, and these port numbers are divided into three categories:
- The scope of the first class is 0~1023, known as a well-known port, which is used by specific network programs, for example, the TCP protocol uses port 80 to complete the transmission of the HTTP protocol.
- The scope of the second class is 1024~49151, called the enlistment port, and should not normally be used in the program.
- The scope of the third class is 49152~65535, known as private ports, which can be used by ordinary user programs.