Java Network programming

Source: Internet
Author: User

Network programming: Focus on the transmission of the underlying data.

Web programming: Focus on interacting with customers.


1. Networking: Connect computers from different regions together. For example: LAN, metropolitan area network, internet

2. Address: IP address, you can determine which node of the Internet your computer, which location. Determine an absolute address, location on the network. Make a metaphor, which is equivalent to the address of a house.

3. Port number:

There are many programs in the computer, such as qq,msn and so on. Then the computer is how to know QQ program, and QQ server docking, MSN program and MSN Server docking it.

The port number is the same as the door (the metaphor continues above, a computer resembles a house).

The port number is used to differentiate the software on the computer. Equivalent to the door. The port number is 2 bytes and has a total length of 65,536 0~65535.

The port number cannot be duplicated under the same protocol, and different protocols can be duplicated.

Recommended not to use the following 1024, the operating system reserved for some common software.

4. Resource positioning:

URI and Url:uri, unified resources; URL: Unified resource Location.

5. Transfer of data:

In order to ensure the normal transmission and communication of data, the use of protocols is required. Protocol: TCP protocol and UDP protocol.

1) Agreement (key content)

(1) TCP (transmission Control protocal Transmission Protocol) protocol is similar to "call", three-time handshake, connection-oriented, must first connect and re-communication, high security, efficiency is relatively low.

(2) The UDP (user Datagram protocal Subscriber Datagram Protocol) protocol is similar to "texting"; non-connection-oriented with low security but high efficiency. Just send a message.

2) Transmission:

(1) First encapsulation: Network layering (layer 4) in order to better encapsulate.

(2) Re-unpacking



The following correspond to these concepts of the network and need to find the corresponding packaged Java classes.

1. Address: inetaddress inetsocketaddress

2.URL:

3. Agreement:

Tcp:serversocket Socket

Udp:datagramsocket Datagrampacket



The bottom of the data transfer is the stream.


This article is from the "Snowflake" blog, make sure to keep this source http://6216083.blog.51cto.com/6206083/1836655

Java Network programming

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.