20165336 2016-2017-2 "Java Programming" Week 9 Learning Summary

20165336 2016-2017-2 "Java Programming" Week 9 Learning Summary

Textbook learning content summary

1. URL class: The URL class is an important class in the java.net package. An application that uses URL to create an object is called a client program.
2. A URL object usually contains the most basic three parts of information: protocol, address, and resource.
3. UEL construction method: public URL(String spec) throws MalformedURLException。
4. Read resources in URL: URL object call InputStream openStream().
5. InetAdress class: address representation: domain name, IP address
6. Get the address of the host on the Internet:

  • You can use the static methods of the InetAddress classgetByName(String s);
  • Get an InetAddress object, the object contains the domain name and IP address of the host address, the object
  • Express the information it contains in the following format:
    www.sina.com.cn/202.108.37.40

7. Get the address of the local machine
You can use the static method getLocalHost() of the InetAddress class to obtain an InetAddress object, which contains the domain name and IP address of the local machine.
8. Socket:

  • client socket
  • ServerSocket objects and server-side sockets:

9. Use multi-threading technology: In order to prevent blocking threads, after the server receives a client's socket, it should start a thread dedicated to serving the client.
10. UDP data packets: send data packets, receive data packets
11, broadcast datagrams
12, JAVA remote call: remote object proxy, RMI design details

Problems and solutions in code debugging

Question 1: When using IDEA to adjust code specification and refactoring, the code must be selected, otherwise debugging cannot be performed.

code hosting

(screenshot of the running result of the statistics.sh script)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325038002&siteId=291194637