Network Programming learning notes (1) BASIC network knowledge and network programming learning notes

Source: Internet
Author: User

Network Programming learning notes (1) BASIC network knowledge and network programming learning notes
1. network communication protocol: there must be some agreed protocols for communication in computer networks, and standards should be set for speed, transmission code, code structure, transmission control steps, error control, and so on. 2. Network Communication Interface: In order to enable communication between two nodes, a communication tool (that is, an interface) must be established between them to enable information exchange between them. The interface consists of two parts: (1) Hardware Device: information transmission between nodes (understood as NICS) (2) software device: agreed protocol for communications between the parties 3. Communication Protocol layering: communication can be performed between the same layer. The previous layer can call the next layer without being associated with the next layer. The layers do not affect each other and facilitate system expansion. Network Protocol layering usually regards user applications as the highest level, and physical communication lines as the lowest layer. protocol processing during this period is divided into several layers, specifying the tasks processed by each layer, it also specifies the interface standards for each layer. Each layer can be independently expanded as long as the interfaces between them remain unchanged. Application Programming is to compile only one layer of the application. The underlying things are blocked, so you don't have to worry about it. You only need to know the interface. Layered thinking is everywhere. The command issued by superiors to lower levels is also a layer-by-layer idea.

 

In actual development, the four-layer model, network layer (IP layer), transmission layer (TCP, UDP layer) communication transmission process is applied: machine A> application layer of A> TCP/UDP layer of A> IP layer of A> physical layer of B> IP layer of B -> the TCP/UDP layer of B> the application layer of B> the unique IP address is provided, it facilitates communication between machines. The computer uses four bytes (IPV4) to represent the IP address, each of which is 0-255. the Intranet Ip address is used in the LAN. The intranet Ip address is actually a fake Ip address. If all machines in the Intranet are connected, there is actually only one IP address, that is, the IP address of the machine on which the gateway is deployed. Because the Ip address may not be enough, some of the IP addresses that have extended the IPV6 (8 bytes) Four bytes may be network IP addresses, and the network Ip address occupies one byte of the-class network, the two bytes belong to the class B network, and the three bytes belong to the class C network. The gateway machine generally has two NICs, one with the public network and the other with the Intranet. If the content on a machine is accessible to all machines in the world, a public IP address is required. 4. TCP protocol and UDP protocol TCP (transmission control protocol): specifically designed to provide reliable, end-to-end byte stream communication protocol on unreliable Internet. Is a connection-oriented protocol. TCP connections are byte streams rather than Packet streams. Reliable: A connection must be established before data can be transmitted. Each time data is sent, it must be confirmed by the other party (TCP three-way handshake ). For example, A and B call A: Hello (You have to wait until B replies to you to say the next sentence) B: Hello A: run together tomorrow (You have to wait until B replies to say the next sentence) B: good. A: set at tomorrow morning (if B does not reply "good", A's "set at tomorrow morning" won't be sent out) UDP (user data protocol ): it is an unreliable connection that provides an application with a method to send encapsulated original IP datagram without establishing a connection when sending it. In the example above: A said to run together tomorrow, regardless of whether B has received the report. TCP is reliable, but slow; UDP is not reliable, but fast. For example, for bank transfers and other transactions, the TCP protocol must be used, while for QQ videos and other communications, UDP is used. Dropping one or two packets has no effect. UDP is used to launch game bullets; for games and other servers, TCP is used to transmit user names and passwords.

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.