"Socket Programming" Java communication is so refined

Source: Internet
Author: User

Brief introduction

Network everywhere, the mobile internet era has already come, stand-alone version of the program slowly has no vitality, all the programs must be able to access the network, such as QQ network chat program, Thunder download program, and so on, these programs are to deal with the network, this time will share with you small partners is Java network programming- Socket communication.

Basic knowledge of the network

The conditions that two computers must have to communicate over the network:

A, the unique identification (IP address);

b, the need for a common language (agreement);

C, identify different applications (port number).

The key concepts are as follows:

1. IP Address

The unique identity of each computer, used to differentiate the different hosts in the network, is essential for network communication between the two hosts.

2. Agreement

TCP/IP protocol: the most widely used protocol in the world today . is a collection of multiple protocols at different levels based on TCP and IP. Also known as: TCP/IP protocol family or TCP/IP protocol stack.

Tcp:transmission Control Protocol Transmission Protocol

Ip:internet Protocol Internet Protocol

TCP/IP model (network tiering), layered as:

    1. Physical layer: Network cable ... And so directly accessible.
    2. Data Link Layer
    3. Network layer
    4. Transport Layer:TCP/IP protocol
    5. Application layer:HTTP Hypertext Transfer Protocol, FTP File Transfer Protocol, SMTP Simple mail delivery protocol, Telnet remote login service.

3. Port number

    • Used to differentiate between different applications ;
    • The port number range is 0-65535, where 0-1023 is reserved for the system ;
    • The IP address and port number make up the so-called socket, which is the endpoint of the bidirectional communication link between programs running on the network, and is the basis for TCP and UDP.
    • Common port number- http:80; ftp:21; telnet:23 (can remember).

---------Network support in Java

For the different levels of network communication, Java provides four main types of network functions:

1. InetAddress: Used to identify hardware resources on the network. is to identify the IP address .

2, URL: Uniform Resource Locator ---can read or write directly to the data on the network through a URL.

3. Sockets: Socket-related class for network communication using the TCP protocol .

4, Datagram: Using the UDP protocol , the data is stored in the datagram, communication through the network.

Directory

Here is a list of the total socket contents, click on the corresponding directory can jump to the corresponding blog post, no accident is more , please gaga attention to the first time to receive updated information Oh ~

There are also suggestions to bookmark This blog Oh, as a directory can easily jump to the corresponding content, more convenient and fast (?ω?) Y

    • Application of network-related APIs in "socket Programming" Java
    • "Socket Programming" for TCP programming via sockets
    • "Socket programming" for UDP programming via sockets (Updated tomorrow)
    • "Socket Programming" Socket Summary & Integrated Programming applet

"Socket Programming" Java communication is so refined

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.