Practical computer network programming job 3.doc

Source: Internet
Author: User

1. Fill in blank questions (1) There are two classes in the java.net package  SocketAnd ServersocketUsed to create socket communication on the client and server respectively. (2) We can use the socket method separately. Dateinputstream ()And Dateoutputstream ()To create an input/output stream. (3) You can use  Accept ()Method to receive connection requests from the client program. After the communication task is completed Close ()Method to disable the communication socket. (4) we can use DatagramsocketClass to establish a socket for datagram communication; Use  DatagrampacketClass to create a data packet package. (5) We can DatagrampacketClass Method Datagrampacket (byte [] Buf, int length, inetaddress address, int port)Obtains the byte array encoding of packets from the instance. Getaddress () To return the IP address of the machine that sends or receives the packet. (6) we can call  Receive ()Method to receive data packets.  Send ()Method To send a datagram. (7) after the communication task is completed Close ()Method to disable the datagram communication socket. (8) create a URL object 4Method {Public URL (string spec) Public URL (URL context, string spec) Public URL (string protocol, string host, string file) Public URL (string protocol, string host, int port, string file )}(9) In the new URL (URL, string) format, the string parameter indicates  URLFile Path(10) string URL. gethost () indicates that Obtain the Host Name of the URL.(11) string URL. GetFile () indicates obtaining Get the URL File Name

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.