Baidu encyclopedia

Open System Interconnect (OSI) stands for Open System interconnection. Commonly known as the OSI reference model, it is a network interconnection model developed by ISO in 1985. The architecture standard defines a seven-layer framework for network interconnection (physical layer, data link layer, network layer, transport layer, session layer, presentation layer, and application layer).

TCP/IP is a set of communication protocols used to interconnect networks. The Internet network architecture is based on TCP/IP. The TCP/ IP-based reference model divides protocols into four layers: the network access layer, the Internet layer (host-to-host), the transport layer, and the application layer.

Comparison between OSI reference model and TCP/IP model

hierarchy

Similarities: Both use a layered architecture; Differences: The TCP/IP reference model is more simplified than the OSI reference model.

Hierarchical relationships

Similarities: peer-to-peer layer communication; The difference: the TCP/IP reference model has a cleaner hierarchy than the OSI reference model.

function

Functionally, the transport layer and above provide point-to-point, network-independent transport services for communicating processes in both models. The TCP/IP reference model has better network management capabilities than the OSI reference model.

Data Transmission Principle

The data transmission principle of TCP/IP model is divided into several steps:

(1) When the data of application process A is transmitted to the application layer, the application layer adds the control header of the application layer to the data, organizes it into the data service unit of the application layer, and then transmits it down to the transmission layer.

(2) After receiving the data unit, the transmission layer adds the control header of this layer to form the data service unit of the transmission layer, which is called message.

(3) When the transmission layer transmits the message to the network layer, because the length of the data unit at the network layer is limited, the long message at the transmission layer will be divided into several shorter data segments. Each data segment, together with the control header of the network layer, constitutes the data service unit of the network layer, which is called a packet.

(4) When the packets of the network layer are transmitted to the data link layer, the data service unit of the data link layer is formed with the control information of the data link layer, which is called frame.

(5) After the frames of the data link layer are transmitted to the physical layer, the physical layer will be transmitted through the transmission medium in the form of bit stream. When the bitstream reaches the destination node host B, it is uploaded from the physical layer by layer. Each layer processes the control header of its corresponding layer and sends the user data to the higher layer. Finally, the data of process A is sent to process B of host B, realizing the transparent transmission of data.

The transmission of data in the OSI reference model is exactly the same as the TCP/IP model

In fact, both the OSI reference model and the TCP/IP model, is one of the layers of data the sender is equivalent to add their respective control information to the data on the upper, then pack to continue moving forward together, and the data of the layers of the receiver is will receive packets to extract, remove the sender peer layer added on the data of control information, Then pass to the upper layer, and finally realize the transmission of data.

Ii. Related concepts

  • HTTP/HTTPS application layer protocols, and FTP/TELNET/SMTP/DNS.

HTTP HyperText Transfer Protocal

The most notable feature is that each request sent by the client requires a response from the server, and at the end of the request, the connection is released. The process from establishing a connection to closing a connection is called one connection.

  • HTTPS Hyper Text Transfer Protocol over SecureSocket Layer

It is a network protocol constructed by HTTP and TLS/SSL to encrypt transmission and authenticate identity. It encrypts Internet data transmission through digital certificates, encryption algorithms, asymmetric keys and other technologies to secure Internet transmission.

Information about the HTTP/HTTPS blog.csdn.net/xiaoming100…

  • TCP/UDP Transport layer protocol

TCP Transmission Control Protocol

TCP requires a three-way handshake to establish a connection and a four-way handshake to release a connection

User Datagram Protocol

  • IP network layer protocols provide host-to-host communication

With IP, different hosts can exchange data. However, when the computer receives data, it does not know which process the data belongs to (a process is simply a running application). The purpose of TCP is to let us know which process this data belongs to, so that the communication between processes can be completed. To identify which process the data belongs to, we assign a unique number to the process that needs to communicate with TCP. This number is what we call a port number.

  • Socket is the intermediate software abstraction layer of communication between application layer and TCP/IP protocol family. It is a group of interfaces.

The transport layer implements end-to-end communication, so each transport layer connection has two endpoints. So what are the endpoints of transport layer connections? Not the host, not the IP address of the host, not the application process, not the transport layer protocol port. The endpoints of transport layer connections are called sockets. As defined in RFC793, port numbers are concatenated to IP addresses to form a socket. A socket is actually a communication endpoint. Each socket has a socket number, including the IP address of the host and a 16-bit host port number, such as (Host IP address: port number). For example, if the IP address is 210.37.145.1 and the port number is 23, the resulting socket is (210.37.145.1:23).

TCP three times handshake and four times recycling details

3.1 Three handshakes caricature

As shown in the figure below, the two robots confirm that each other can receive and send messages correctly through three handshakes (image source: Illustration HTTP).

  • Client – sends packets with the SYN flag – one handshake – server
  • Server – sends packets with SYN/ACK flags – secondary handshake – client
  • Client – sends packets with ACK flags – three-way handshake – server

3.2 Why three handshakes

The purpose is to establish a reliable communication channel. When it comes to communication, simply speaking, it is the sending and receiving of data. The main purpose of the three-way handshake is to confirm that the sending and receiving of each other is normal.

  • The first handshake the Client can’t determine anything. The Server confirms that the peer sends messages properly and the Server receives messages properly.
  • The second handshake the Client confirms that the sending and receiving function of the Client and the receiving function of the peer are normal. The Server confirms that the peer sends messages properly and the Server receives messages properly.
  • Third handshake The Client confirms that the sending and receiving operations are normal by itself and the receiving operations by the other party. The Server confirms that the peer sends and receives messages properly and the Server sends and receives messages properly. Therefore, only after three handshakes can we confirm that both parties send and receive normally.

3.3 Why wave four times

  • Client – Sends a FIN to shut down client-to-server data transfer.
  • Server – Receives the FIN and sends an ACK to the client confirming the received FIN plus 1.
  • Server – Closes the connection to the client and sends a FIN to the client.
  • Client – Returns an ACK message to the service for confirmation, and sets the acknowledgement sequence number to receive sequence number plus 1. For example: A and B on the phone, after the call is coming to an end, A said “I do not have what to say,” replied “I know” B, but B may also have to say, can’t ask B end call follow their own rhythm, so B may barak barak said A phone again, finally B said, “I said,” A answer “know”, such talk is over. Blog.csdn.net/qzcsu/artic…