Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the transmission process of user data and protocol header information in TCP/IP protocol

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

It is believed that many inexperienced people do not know what to do about the transmission process of user data and protocol header information in TCP/IP protocol. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

1. Layering of network protocols

From the bottom layer to the upper layer, they are: link layer, network layer, transport layer and application layer.

Here, take the FTP protocol as an example to see how the client and server interact at the protocol level.

In the local area network, the link layer is basically the same, Ethernet as an example, as shown in the following figure, the corresponding protocol stack needs to use the corresponding protocol to exchange data.

In different Lans, the link layer is often different, assuming that one is Ethernet and the other is token Ring, then the routing protocols corresponding to the IP layer need to support these two networks at the same time. With the support of routers, the two networks can adapt to each other in order to communicate with each other.

At the top of the IP layer, this part of the difference has been shielded, so in the transport layer and application layer, it is consistent with the internal communication of the local area network.

two。 Encapsulation and reuse of Network protocols

Before we study the encapsulation and division of data, let's take a look at the network protocols at the corresponding levels, as shown in the following figure:

The first problem involved in sending data from one end to the other is how to package the data. This packaging standard needs to be discussed in advance. The strategy is to add a corresponding protocol layer header to each layer and pass it down.

When sending data in the application layer, the corresponding user data needs to be packaged at the application layer first, so that a corresponding header of the application layer will be added at the protocol level of the application layer. constitute a whole data of "application layer header + user data" = application data.

The application layer data is passed down to the TCP layer, and the TCP will add a message header to the "TCP header + application layer data" = TCP data, and pass it to the IP layer.

After the IP layer receives the data, it adds an IP header, becomes "IP header + TCP data" = IP data, and passes it to the link layer.

Assume that the link layer is Ethernet, so the link layer data becomes "Ethernet header + IP data + Ethernet tail" = Ethernet data.

For the receiver, it is just the opposite to the sender, and the corresponding protocol layer will peel off the data header of this layer, parse the data according to the specification, and pass it to the upper layer until the corresponding application.

For example, the IP layer will know whether the transport layer is UDP or TCP according to the data bits of the IP header, and decide whether to pass the IP data to UDP or TCP protocol to continue processing.

Header data of the 3.IP layer

The IP header consists of 20 bits of bytes, in which the length of IP data is U16, the maximum is the first checksum of 65535 Magi U16, the lifetime of U8, and the protocol of U8 (this is used to record what kind of protocol the transport layer is, UDP or TCP). The source IP address of U32 and the destination IP address of U32.

The data header of IPv6 is described below, where the source and destination addresses are both 16 bytes in size.

The picture comes from the Internet. If you are informed of the infringement, it will be deleted in time.

4.UDP header

UDP header + UDP data together constitute UDP data, which is encapsulated in IP data as the data content of IP, in which the UDP header is only 8 bytes in size.

The details of UDP premium content are as follows: the source port and destination port of U16. This field is intended to distinguish between different applications on the same machine that use the same IP address.

The UDP data length of U16, in fact, the data length of IP is U16, so the data length of UDP layer should be: IP data length-8-byte UDP header length.

U16's UDP test sum, this UDP is optional.

5.TCP header

TCP data consists of: TCP header + TCP data, TCP data. Will be encapsulated in IP data, where the TCP header is made up of 20 bytes, as shown in the following figure:

The picture is from the brief book App.

The first part of TCP, the details are as follows:

The source and destination ports of U16 are used to distinguish between different applications under the same IP address. The serial number and confirmation number of U32 are used to realize the reliability transmission of TCP, which is an important part of TCP reliability transmission, which is completed by REQ+ACK. With regard to the sequence number, it is a sequence number randomly generated according to the relationship of time, an incremental way of generation.

The identification bits SYN and ACK are used for the three-way handshake. FIN is used to wave four times. RST indicates a reset connection. PSH indicates that the data needs to be sent to the receiving process as quickly as possible.

The window size of U16, which is used to control the traffic transmission rate of TCP. The checksum of U16, which must exist, is part of ensuring the reliability of TCP.

After reading the above, have you mastered the transmission process of user data and the method of protocol header information in TCP/IP protocol? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report