URL (Uniform Resource loactor abbreviation of Uniform Resource Locator) through the constructor can get URL object url = new URL ("http://www.cnblogs.com ");
Basic URL Method
Getportocal (): Get the transfer protocol
Gethost (): Get the Host Name
Getport (): Get the port number
GetFile (): Get the resource file name
Urlconnection is an abstract class. It is a dynamic connection to the data source specified by the URL. It provides more powerful server interaction functions than the URL, data can be submitted to the server using post/get and other HTTP request methods.
Getcontenttype (): Get the Document Type
Getcontentlength (): Object Length
Getdate (): the time when the file was created.
Getlastmodified (): Last object modification time
Getinputstream (): input stream
TCP/IP server and client socket
Socket sockets are divided into server sockets and client sockets.
Client socket specifies the server address and port number to be connected socket socekt = new socket (string host; int port)/Socket socket = new socket (inetaddress add, int port)
Server socket serversocket Ss = new serversocket (INT port); the server socket runs on a specific port of the server and listens to TCP requests on this port. After the client requests a connection and passes verification, the server can interact with the client.
Inetaddress is an IP address class. You can obtain the inetaddress object getlocalhost (), getallbyname (string IP/host), and getbyname (string IP/host) in three ways ); getbyaddress (byte [] ADDR)
Getbyaddress (string host, byte [] ADDR ).
Obtain the Host Name: getcanonicalhostname (); The creation method of inetaddress (string local/string IP/string host) determines whether domain name resolution is required. The first one does not need domain name resolution, third, uncertainty
Obtain the host alias: gethostname (); The creation method of inetaddress (string local/string IP/string host) determines whether domain name resolution is required, both the first and third do not use domain name resolution.