20165237 2017-2018-2 "Java program Design" 9th Week Study summary Textbook study summary
1, the URL class is an important class in the java.net package, the instance of the URL encapsulates a Uniform Resource Locator (Uniform Resource Locator), the application that uses the URL to create the object is called the client program.
2, a URL object usually contains the most basic three parts of information: protocol, address, resources.
3. The URL class typically creates a URL object using the following construction method:
- Public URL (String spec) throws Malformedurlexception
- Public URL (String protocol, string host,string file) throws Malformedurlexception
4. Socket:
The IP address identifies the computer on the Internet, and the port number identifies the process (program) that is running on the computer. The port number is defined as an integer between the 16-bit 0~65535.
5. When two programs need to communicate, they can establish a socket object by using the socket class and join together (a network socket is derived from the combination of port number and IP address).
6, UDP-based communication and TCP-based communication are different, UDP-based information transmission is faster, but does not provide reliability assurance.
7, the basic mode based on UDP communication is:
- Package the data, called a packet (like loading a letter into an envelope), and then send the packet to the destination.
- Accept packets sent by others (like receiving envelopes), and then view the contents of the packet.
8. Receive the packet:
First, create an object with Datagramsocket's other construction method datagramsocket (int port), where the parameters must be the same as the port number of the packet to be received. For example, if the sender sends a packet with a port of 5666, then create the Datagramsocket object as follows:
Datagramsocket mail_in=new Datagramsocket (5666);
The object mail_in then accepts the packet using method receive (Datagrampacket pack).
Use another construction method of the Datagrampack class: Datagrampack (Byte data[],int length) to create a packet to receive the packet, for example:
byte data[]=new byte[100]; int length=90;
The packet pack will receive data with length bytes.
9, Java Remote Call, RMI (remote Method invocation) is a distributed technology, using RMI allows an application on one virtual machine (JVM) to invoke an object method on a JVM that is located on another place on the network. The virtual machine (JVM) that is used to call the request is the (local) client, which is said to accept and execute the requested virtual machine (JVM) as a (remote) server.
Code upload:
Code Hosting
(run result of statistics.sh script)
Learning progress Bar
|
lines of code (new/cumulative) |
Blog Volume (Add/accumulate) |
Learning Time (new/cumulative) |
Important Growth |
Goal |
5000 rows |
30 Articles |
400 hours |
|
First week |
80/80 |
1/1 |
18/18 |
Learn to write simple Java applications |
Second week |
357/437 |
2/3 |
15/33 |
Mastering the use of arrays, symbols, and data |
Third week |
695/1132 |
2/5 |
20/53 |
Understanding the basic structure and construction methods of classes and objects |
Week Four |
765/1897 |
2/7 |
27/70 |
Understanding subclasses and inheritance, interfaces and implementations |
Week Five |
1174/3071 |
2/9 |
15/85 |
Learn to handle anomalies, understand the use and characteristics of file streams |
Week Six |
1175/4186 |
1/10 |
18/103 |
Learn about common utility classes and generic and collection frameworks |
Seventh Week |
874/5060 |
3/13 |
14/117 |
How to create a data source and master JDBC connections |
Eighth Week |
950/6010 |
2/15 |
13/130 |
Understanding the multithreading mechanism of Java |
Nineth Week |
1063/7073 |
3/18 |
10/140 |
Understanding Java Network Programming |
20165237 2017-2018-2 "Java Programming" 9th Week study Summary