As a Web programmer 👨💻, you should understand the network model and know exactly how the network communicates and works, and why the server can receive and respond to requests. The principle behind this should be something every Web programmer should know.

History and origin of network models

Network model is not the beginning, at the beginning of network development, network protocol is defined by the various Internet companies, such as when the giant network company of IBM, Microsoft, apple, cisco, etc., every company has their own network protocol, each house also can’t exchange protocol, then we think it is possible, But for consumers it’s actually a technology monopoly, because if you buy an Apple device you can’t use a Microsoft device because their protocols are not the same, there’s no unified standard to regulate the network protocols, it’s all proprietary to these companies.

The Open Systems Interconnection Model (OSI), the International Organization for Standardization, in 1984, was a standard, not an implementation.

TCP/IP protocol is designed based on this model.

The OSI model

OSI model is from the top down, the lower the more close to the hardware, the higher the more close to the software, these seven layer models are physical layer, data link layer, network layer, transmission layer, session layer, presentation layer, application layer.

The hierarchical model is a commonly used method in our computer science, layered directly by specifying a good interface to interact, each layer to the upper or the lower actually is a black box, it’s the inside of the upper and the lower also don’t care about it, only care about their interaction between the interface, the interface is information, to give to what is good.

Benefits of the layered model is that can be independent of any layer upgrade and optimization, as long as the interface unchanged so there would be no problem this model as a whole, such as the physical from the Ethernet cable to optical fiber, our network speed is greatly increased, but the technical innovation, the other is to do more work, work to be done only in the physical. The benefits of doing this also increase the rate of innovation in our technology.

Hierarchical functional responsibilities

  • Physical layer: Underlying data transmission, such as network cables; Network card standard.
  • Data link layer: define the basic format of data, how to transmit, how to identify; For example, the MAC address of a nic.
  • Network layer: define IP address, define routing function; Such as data forwarding between different devices.
  • Transport layer: Basic functions of end-to-end data transmission; Such as TCP and UDP.
  • Session layer: Controls the ability to talk between applications; For example, data is distributed to different software.
  • Identification layer: data format identification, basic compression encryption function.
  • Application layer: various applications, including Web applications.

Data interaction

Let’s simplify the model and assume that computer A and computer B need to exchange information. For example, A develops A web page and B needs to visit it. B sends A request to A. The request data is transmitted from B’s application layer down to the presentation layer, and then from the presentation layer to the session layer and then to the physical layer. After receiving the request, the physical layer of A sends the request up to its own application layer. The application layer then passes the requested data to its own physical layer and THEN B receives the data and passes it to its own application layer. To simplify things, we’ve removed the logic of three handshakes and four waves.

This is how data is transferred between computers and networks. The job is to unpack each layer and append its own message, a term called a header.

At the fourth layer, both the transmission layer data is called Segments; Three network layer data are called Packages; At layer 2 data link layer, data is called Frames. At the first physical layer, data is called a bit stream (Bits).

TCP/IP model simplifies OSI model from seven layers to four layers, and the transport layer and network layer are completely retained. Therefore, the most core technology in the network is the transport layer and network layer technology.

Examples of each layer of TCP/IP:

Network access layer: ARP and RARP

Internet layer: ICMP and IP

Transport layer: TCP and UDP

Application layer: DNS, FTP, HTTP, SMTP, TELNET, IRC, WHOIS

conclusion

The seven-tier network model is a standard, not an implementation.

The network four – layer model is an implementation application model.

The four – layer network model is simplified and combined by seven – layer network model.