Week13 "Java program design" The 13th time work summary

Source: Internet
Author: User

Week13 "Java Programming" 13th operations Summary 1. Summary of this week's study

Summarize multiple web-related content in the way you like (mind Mapping, OneNote, or others).
For:
1.IP and port: IP and Domain name correspond, can find host. The ip+ port (the port in the TCP/IP protocol) locates the corresponding program on the host.
Web Services: 80
FTP Service: 21
Telnet Service: 23
2. Socket communication: Enables client and server-side connections.

    • Network communication is performed on the stream operation obtained from the socket object.
    • Establishes a socket object that gets the stream from the Scoket object.
    • Network communication for convection operations
    • Close the Socket object resource.
      3.ServerSocket:
    • Not a socket, not a socket.
    • is not responsible for specific communication with the client.
    • Accept method: Listen port, wait for network request connection, return socket object.
      4. Multithreaded server: Generates a socket object for each client, using multithreading technology, each thread invokes a different socket object to communicate with its client.
      5.URL class: Uniform Resource Locator. You can open a stream that reaches the resource. It is more convenient for Web service communication with the socket.
      6.TCP and UDP:
      TCP: Reliable transmission, connection oriented. Using the socket, always use the TCP protocol.
      UDP: Unreliable, for no connection, send packets directly
2. Add network functions to your system (shopping cart, library management, landlords, etc.)-group complete

To allow your system to be used by multiple users over the network, you need to add network functionality to your system.

2.1 What network functions do you want to add to your system? What is the design idea?

A: When multiple clients access the book system, each customer is generated a socket object, by the ServerSocket object's accept monitoring design of the port, when there is a connection when the socket object is generated, and then the socket object is passed into a thread, In this thread in the system login, register, borrow books and other operations.

2.2 What information does the system pass through the network? What is the format of the information?

A: The system transmits library information through the network. The information format is a character stream, and both the client and the server are getting inputstream and outputstream streams.

2.3 Does your network module use TCP or UDP technology? What are the common classes in a module?

A: Using TCP technology, common classes are serversocket,socket.

2.4 Network communication part of the source code and run, and to do a simple explanation.

Note: If you do not write a client, you can use telnet or * * Network debugging Assistant * To do the client.
For:



The client program is given a system port number for access. The system side listens for connections, and initiates the thread if there is a connection. (not running successfully).

3. Code volume Statistics 3.1 Statistics the amount of code completed this week

The weekly code statistics are required to be fused into a single table.

Week Time Total code Amount New Code Volume total number of files number of new files
1 0 0 0 0
2 0 0 0 0
3 0 0 0 0
4 0 0 0 0
5 739 739 16 16
6 1084 345 28 12
7 1180 96 30 2
8 1627 64u 35 5
9 1986 359 44 9
10 2350 364 56 12
11 2534 184 61 5
12 2909 375 70 9
13 4135 1226 93 23
14 4135 0 93 0
15 5584 1449 113 20
Option: 4. Network Learning Guide (the following job content is selected) 1. Network Fundamentals 1.1 Comparison ping www.baidu.comAnd ping cec.jmu.edu.cn, what is the difference between the analysis and return results? Why is there such a difference?

For:

    • Visit Baidu for a long time, access to the campus education network faster. TTL is different, access to Baidu's TTL is small. TTL is the lifetime of a packet, minus one TTL per router. From the computer sent to the Baidu Server packet on the router for a long time, due to distance reasons, access to campus network TTL larger.
1.2 Telnet bbs.newsmth.net, what port number does this command connect to the remote host?

Answer: Port number is 23
1.3 telnet cec.jmu.edu.cn 80, try to answer: what do you see from the screen? Is the content returned from the home page of cec.jmu.edu.cn? What will I return if I try to use the Get/index http/1.0 command? See the experimental Task Book topic 1.
For:

    • No content
    • According to the following operation, return to Cec.jmu.edu.cn's home page content, may be different encoding, there is garbled phenomenon
    1. Telnet cec.jmu.edu.cn 80
    2. CTRL +]
    3. Press ENTER
    4. Input get/http/1.0
    5. Press ENTER twice
1.4 Start the Connectionwatcher, and then start a number of Internet-enabled programs (such as QQ, Telnet, browser, etc.), to see what the computer on the Internet, what port is used? What ports does QQ use to interact with those remote IPs, where are these IPs distributed? What protocols are used for communication?

For:

Using the QQ browser, qq,360 and so on, using 443,80 and other ports. The TCP/IP protocol is used.

2. Write a TCP client program 2.1 reference Sockettest.java write a simple connection to the remote server applet Client.java, you can receive and display the information sent by the server. The remote host IP and port number must first be specified on the console at startup. (, show your own school number).

For:

2.2 Change the URL of the program to Bbs.newsmth.net, the port number to 23, and observe the return result again? Try to perform Telnet bbs.newsmth.net 23, comparing the returned results.

For:

Perform Telnet bbs.newsmth.net 23:

Week13 "Java program design" The 13th time work summary

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.