Network programming Overview and three elements (ip/port number/protocol) and socket communication principle

Source: Internet
Author: User
Tags bind socket port number

I. Overview of network Programming

1, the computer network refers to the different geographical location of multiple computers with independent functions and their external devices, through the communication line, in the network operating system, network management software and network communication Protocol management and coordination, the realization of resource sharing and information transmission of computer systems.

2, network programming is used to realize the network interconnection between the different computers running programs can exchange data.

two, network programming three elements of IP overview IP: The unique identity of each device in the network. Each network terminal has a separate address in the network, and we use this address to transmit data over the network. CMD command:
Ipconfig: view native IP192.168.12.42 ping: Test connection 192.168.40.62 Local loop address: 127.0.0.1 broadcast address: 255.255.255.255 ipv4:4 bytes composed of 4 0-255. About 4.2 billion, 3 billion are in North America, Asia 400 million. At the beginning of 2011 was exhausted. Ipv6:8 Group of 4 16 binary numbers per group.
Ipv6:8 Group of 4 16 binary numbers per group. 1A2B:0000:AAAA:0000:0000:0000:AABB:1F2F 1a2b::aaaa:0000:0000:0000:aabb:1f2f 1a2b:0000:aaaa::aabb:1f2f 1a2b:0000: AAAA::0000:AABB:1F2F 1a2b:0000:aaaa:0000::aabb:1f2f

third, the network programming three elements of the port number overview Port number: Each program on the device unique identity each network program needs to bind a port number, when transferring data in addition to determine which machine to send, but also to the specific program to send. Port number range from 0-65535 to write a network application will need to bind a port number, try to use more than 1024, 1024 or less is basically a system program occupied. Common ports
mysql:3306 oracle:1521 web:80 tomcat:8080 qq:4000 feiq:2425

When two devices are logged into 3 different chat tools at the same time, the message sent by QQ on this computer can be sent to the QQ of another computer accurately because the same application has the same port number.

Iv. Protocol Overview of three elements of Network programming protocol: A set of rules, standards, or conventions established for data exchange in a computer network.
UDP: For no connection, data insecure, fast. The client and server are not differentiated. TCP: Connection-oriented (three-time handshake), data security, slightly lower speed. Divided into client and server. Three-time handshake: The client initiates a request to the server, the server responds to the request, transmits the data

Five, the socket Communication principle diagram

Overview of socket Sockets: A combination of IP addresses and port numbers that have a unique identity on the network can form a uniquely identifiable identifier socket. Sockets are available at both ends of the communication. Network communication is actually the communication between sockets. Data is transmitted via IO stream between two sockets. The socket is created in the application and establishes a relationship with the driver through a binding mechanism, telling itself the corresponding IP and port.

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.