OSI seven-layer model easy to understand explanations

OSI seven-layer model is simple popular understanding

This model learned many times, always remember. Today looked again and found a historical point of view the problem of the deduction would be more logical, easier to remember. This article does not necessarily rigorous, there may be mistakes, mainly to initiate a bad memory to help people. Overall, OSI model was developed from the ground up to the top.
This model introduced the very beginning is because Americans have a need for communication between two machines.

Requirement 1:

The first problem to be solved by scientists is how communication between two hardware. DETAILED some hair is a bit stream, and the other to receive. Thus, scientists have invented physical layer:

Main standards define the physical equipment, such as a cable interface types, the interface of the optical fiber type, transmission rate and other transmission media. Its main role is the transmission bit stream (1,0 is made into the current strength to be transmitted, the destination after conversion to 1,0, that is, we often say that the digital to analog conversion and analog to digital conversion). This layer is called the data bits.

Requirement 2:

Now I can send the data flow through the wire, but I also want through radio waves, transmitted through other media. Then I would like to assure the transmission bit stream past is correct, there must be error correction. Thus, the invention is a data link layer:

It defines how to format data for transmission, and how to control access to the physical medium. This layer usually provide error detection and correction, to ensure reliable data transmission.

Demand 3:

Now I can send the right hair bit stream data to another computer, but when I send a lot of data, it may need a long time, such as a video format, the network is interrupted many times (in fact, even with physical layer and the data link layer, the network is often interrupted, but the interruption time in milliseconds). Well, I also need to ensure the accuracy when transferring large number of files. So, I want to send out the data package. Just made express, as one by one hair. Thus, the first invention is a transport layer (transport layer in the OSI model, network layer in the above)

Such as TCP, is used to send large amounts of data, I sent out 10,000 packets, another computer will tell if I received a 10,000 package, if the package is missing three, he told me that 1001, 234,8888 packets lost, I uh. In this way, we can guarantee the other side to complete the video received.

E.g. UDP, is used to send small amounts of data. I sent out 20 packets, packet loss is generally not so, I do not care how many you get. In multiplayer interactive games, and often use UDP protocol, because usually simple message, but there is a demand broadcasting. If you use TCP, the efficiency is very low, because it kept telling my hosts received 20 packets, or I get a 18 pack, and then send me two! If there are 10,000 computers at the same time we do so, but will reduce the efficiency with TCP, even if not as good as sent out by UDP, the host, you lose a few packages on the card look, well, next time you re-contracting update.

TCP protocol and IP protocol will bind the port, the following will introduce IP protocol.

Demand 4:

Transport layer only solved the problem of packaging. But if I have more than one computer, how to find I want to send that stage? Or, A F to give the information, to go through the intermediate B, C, D, E, but there are many intermediate nodes as KJZY. How do I choose the best path? This is the route to do. Thus, the invention is a network layer. That router, a switch device having those functions implemented addressing function. This layer is defined by an IP address, IP address addressing. So generated IP protocol.

5 demand:

Now we have to ensure that the correct computer, send the correct information after the package a. But the good level of user experience is not good? Is it every time I go to call TCP package, and then call the IP routing protocol to find their own to send? Of course not, so we want to establish an automatic send and receive packets, automatic addressing function. Thus, the invention is a session layer. The role of the session layer is the communication between the establishment and management applications.

Demand 6:

Now I can guarantee that the application automatically send and receive packets and routed. But I use Linux to window contract, the two systems are inconsistent grammar, just as the installation package, exe can not be used under linux, shell in the window is not directly run. So we need presentation layer (presentation), to help us solve the communication problems between different grammatical systems.

Demand 7:

OK, now all the necessary conditions are ready, we can write a program android, web program to realize the demand. Supplementary: Socket: This is not a protocol, but a communication model. In fact, it was originally of California, Berkeley, Institute of Software, referred to as BSD invention, mainly used between two processes of a computer communication, then it uses two computers interprocess communication. Therefore, it can be understood as a simple communication, not a high-level inter-process thing. The main thing not to do is:

A contract: send request packet to a port that is already bound (so we often visit this address 182.13.15.16:1235,1235 is the port); B received permits; then formally sent; send over, to tell B Break link; receive off permitted, immediately disconnect, and then send the information to have been disconnected B.

B received package: Binding port and IP; then in this port monitoring; received A's request, allow hair to A, and ready to receive the main thing is to clear the cache waiting to receive new data; then officially accepted; received disconnection request to allow disconnection; disconnecting the acknowledgment, continue to monitor other requests.

Guess you like

Origin blog.csdn.net/weixin_43752167/article/details/91043159