1. This week, learn to summarize multiple Web-related content in the way you like (mind Mapping, OneNote, or others).
2. Written work Q1. Network Fundamentals
1.1 Comparison ping www.baidu.com with ping cec.jmu.edu.cn , how does the analysis return result differ? Why is there such a difference?
- The time to complete a network interaction
ping www.baidu.com is different: 19ms to complete a network interaction; ping cec.jmu.edu.cn for: less than or equal to 1ms to complete one network interaction. The time of return itinerary is different ping www.baidu.com : Minimum 19ms, maximum 19ms, average 19ms
1.2 telnet bbs.newsmth.net , what port number does this command connect to the remote host?
. 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 GET /index HTTP/1.0 a command? See the experimental Task Book topic 1.
No content returned, not cec.jmu.edu.cn home page content; using Get/index http/1.0 command, the cec.jmu.edu.cn home page source code is returned.
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?
1.5 What are some of the essential information required to write a network program?
- Socket (socket), input-output stream (Incoming.getinputstream (), Getoutputstream ()), TCP, UDP protocol.
Q2. Write a TCP client program 2.1 refer to Sockettest.java to 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)
2.2 Change the URL of the program to Bbs.newsmth.net, the port number to 23, and observe the return result again? Try using Telnet bbs.newsmth.net 23. Compare return results
A: The display content is the same
2.3 Change the URL of the program to cec.jmu.edu.cn, and change the port number to 80 to see the results returned. No return results, why?
Answer: You should use the Get/index http/1.0 command
3. ServerSocket and TCP Server
3.1 Simple single thread menuserver, title 3.1-3.4. (Key code and run, including the school number) can use the Network debugging assistant, set it to TCP Client (IP and port fill your menuserver IP and port), connect your menuserver. Which file search function is selected?
3.2 Multi-threaded menuserver. (Prove that you are a multi-threaded server, using Telnet connection)
4. UDP server
4.1 Retrofit 3.1 or 3.2 to transform it into a UDP-based menuserver. (Run the interface code, including the school number). You can use the Network debugging assistant, set it to UDP, to fill the local IP and port also to fill the remote server IP and port.
Q5. Discussion topic: Network program and flow 5.1 written before the program used a lot of knowledge of the flow. Briefly, what kind of flow should I choose when writing a network program? Java network programming, the relationship between streams. Scenarios such as: Simple text chat, file transfer, Application layer protocol server, such as QQ, chat rooms, online games.
When you write a network program, select the stream of input and output streams, and then wrap them in a character stream. The client and the server communicate, in effect, the flow that is obtained in the socket object. To the program, the output to the screen, printers, files, etc. are called output, and read from the file, read from the network, received is counted input.
3. Code cloud codes to submit records
201521123116 Java Programming 13th Week of study summary