Writing in the front
Must have impressed everyone is filed of computer network, protocol, learned and forget, in fact, I, too, but his importance, it is worth learning, no matter you are to learn Java, Python, c + +, etc., this project is necessary to study network class, recently by reading some books, articles, etc., do a systematic summary of meter network, Hope to help you, will continue to update.
The architecture of the network
Before we get into network architecture, let’s start with the question, why is it layered and what are the benefits of layered architecture? In fact, for easy management, each layer only needs to be responsible for its own layer, and only one interface needs to be provided between layers, which not only improves scalability, but also reduces maintenance costs. There are three common architectures, OSI architecture, TCP/IP architecture, and five-tier architecture.So the question is, with all these different architectures, which one is better? Let’s start with thatOSI architectureThis architecture is a standard developed by the International Organization for Standardization (ISO). Suffice it to say, it is quite detailed, but too complex and impractical. Say againTCP/IP architectureIn order to interconnect different network interfaces, the network interface layer does not specify any specific content, so it is not suitable to learn, so came OSI and TCP/IP combination —A five-tier architectureHe combines the advantages of both. Before we get into the five-tier architecture, let’s take a look at the three types of switching commonly used in networks.
Exchange way
The first thing we need to understand is how computers communicate, how data is exchanged, and there are actually three common ways of exchange. A,Circuit switchingAnd second,Message switchingAnd three,Packet switching.Speaking of circuit switching, we need to talk about telephones first, if 2 telephones need to communicate, need a telephone line, and 5 telephones in pairs communication need 20 telephone lines, with the increase of telephones, telephone lines become exponentially increased (N *(n-1)/2), it is this reason, out of the circuit switching to solve this problem.Forwarding is done through a telephone exchange, thus reducing the number of telephone lines. Of course, not all calls are forwarded through a single switch, but actually calls are made through the cooperation of multiple switches.Among themCircuit switchingFirst, the connection is established, then the data is transferred, and finally the connection is released (the switches are connected by trunks and are public). It seems like a simple call, but in the middle of a lot of experience, so hear the ring, can not easily hang up. Message switchingIn this case, there is no need to establish a connection, and the packets are directly sent to the switch of the adjacent node until the destination node. The destination node forwards the packets by looking up the table. There is no limit on the size of packets, so each node needs to have a large cache space. 而Packet switchingJust can solve the problem of packet switching needs large cache space, take a message for packet forwarding, so that each node need not too much cache space, and after group, can data transmission via different routes, improve the efficiency of transmission, do not have your cake and eat it, it also introduces a new problem, is that when a message after the grouping, So how do you concatenate the acceptor, so you need to add a header to the packet, so that the amount of data transferred is increased, but compared to its advantages, this disadvantage is acceptable.
Send a message
Having introduced three ways of exchanging, it’s time to talk about the main part, which isTake the example of A sending “I like you” to B, A for browser, B for server. When A sends A request, it first passes through the application layer, which encapsulates the message into oneHTTP request packet, to the transport layer.The figure above shows the general format of HTTP request packets, which are generally transmitted over the Internet in the following format.Transport layer plusThe TCP header, encapsulated into TCP packet segments (used to distinguish application processes and achieve reliable transmission), and delivered to the network layer.The network layer adds the TCP segment to the packetThe IP header, encapsulated into IP datagrams (which can be transmitted over the Internet, i.e. forwarded by routers) and delivered to the data link layer.Add a header and a tail to the data link layer to encapsulate it asframeThe data link layer passes the frame to the physical layer.The physical layer treats the frame as a bit stream, adds a leading code, and then converts it into a corresponding signal for transmission over the transmission medium.When come across a router, first remove the physical lead code and deliver it to the data link layer, data link layer frame first and tail removed, deliver it to the network layer, network layer parsing IP datagram first, parse the destination address and forwarding, the network layer IP datagram to the data link layer, data link layer to add the first and the tail, The data link layer delivers the frame to the physical layer, which treats the frame as a bit stream and adds leading codes.Then it reaches the server. The server starts parsing from the physical layer, first removing the leading code, then removing the header and tail, then removing the IP header, then removing the TCP header, and finally receiving the HTTP request packet at the application layer.The application layer parses HTTP request packets and sends response packets containing the following contents:We don’t fit(The process is similar to the sending process).After all, a person carries all…References [1] Top-down approach to computer networks. Chen Mingyi. China Machine Press [2] Hu University of Science and Technology teacher. Computer network microclassroom. Bi li bi
Write in the back
Here through a sentence “I like you”, the data transfer process in the network for a description, some details, the subsequent chapter will be detailed, you can pay attention to my public number [Hehe Learning programming], the first time to read the original article, we see you next time ~