Data Encapsulation, generally speaking, is to map business data to the payload of an encapsulation protocol, then fill in the header of the corresponding protocol to form a data packet of the encapsulation protocol, and complete rate adaptation. match.
It can be seen from the above analysis that data packet encapsulation is actually very complicated: to achieve reliable, accurate and efficient purposes, many influencing factors must be considered , and take targeted preventive measures. (Recommended learning: web front-end video tutorial)
In practical applications, the data encapsulation of the network is carried out in layers based on functions. The purpose is very simple, which is to decompose the complex system into many Modules, each module is independent and does not affect each other. Each module (each layer) uses interfaces to connect and interact, and provide services to each other. This not only makes it easier to implement functions, but also makes the entire system have good compatibility and scalability.
The process of data encapsulation is roughly as follows:
1. Convert user information into data for transmission on the network
2. Convert data into data segment, and establish a reliable connection between the sender and the receiving host
3. Convert the data segment into a data packet or datagram, and put a logical address in the header, so that each data packet Can be transmitted through the Internet
4. Packets or datagrams are converted into frames for transmission in the local network. On the local network segment, each host is uniquely identified using its hardware address.
5. Frames are converted into bit streams, and digital encoding and clocking schemes are used
Taking the common OSI model as an example, it is divided into seven layers, from bottom to top: Physical Layer, data link layer, network layer, transport layer, session layer, presentation layer, application layer, each layer corresponds to different functions. In order to realize the corresponding functions, the data will be encapsulated in the protocol header and protocol tail according to the protocol of this layer, and then the encapsulated data will be transmitted to the lower layer. The data encapsulation process of each layer is shown in the figure below.
The transport layer uses the TCP header to mark the connection to a specific application and encapsulates the data into data segments; the network layer uses the IP header to mark the connected device network address. And based on this information, network path selection can be performed. At this time, the data is encapsulated into data packets; at the data link layer, the data has been encapsulated into data frames, and the physical address of the device is given in the MAC header. Of course, Data verification and other functional fields; when it reaches the physical layer, it has been encapsulated into a bit stream and becomes a pure physical connection.
The above is the detailed content of What is data encapsulation called at the data link layer?. For more information, please follow other related articles on the PHP Chinese website!