TCP message packaging method and device, electronic equipment and storage medium

By segmenting and optimizing redundant fields in TCP message transmission, combined with checksum offloading of check status data, the problem of low transmission rate of TCP data packets is solved, and data transmission efficiency and communication performance are improved.

CN119324947AActive Publication Date: 2025-01-17SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411151694.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-21
Publication Date
2025-01-17
Estimated Expiration
2044-08-21

AI Technical Summary

Technical Problem

In the prior art, when TCP data packets are unloaded in segments, the complete header of the IP header and TCP are saved, resulting in a reduced data transmission rate and a large header overhead, which affects real-time communication and efficient transmission.

Method used

By receiving the TCP message sent by the CPU of the local side, after establishing a communication connection between the peer and the local side, segmenting it into at least two segmented messages, optimizing the redundant fields, determining the encapsulated message, and verifying the status of the verification The data determines whether checksum unloading is enabled, thereby reducing header overhead and duplicate transfer of redundant fields.

Benefits of technology

It improves data transmission rate and real-time transmission efficiency, reduces head overhead, avoids duplicate transmission of redundant fields, and improves network communication performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119324947A_ABST
    Figure CN119324947A_ABST
Patent Text Reader

Abstract

The invention provides a TCP message packaging method and device, electronic equipment and a storage medium, and relates to the technical field of data transmission, and the method comprises the steps: receiving a TCP message sent by a CPU of a home terminal, and segmenting the TCP message into at least two first segmented messages under the condition that an opposite terminal and the home terminal establish communication connection; optimizing a redundant field in each first segmented message, and determining each first encapsulation message; for each first encapsulation message, determining a second encapsulation message corresponding to the first encapsulation message based on verification state data corresponding to the home terminal; the verification state data is used for indicating whether the first encapsulation message enables verification and unloading or not. The invention can effectively reduce the head overhead and improve the data transmission rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data transmission, and in particular to a TCP message encapsulation method, device, electronic equipment and storage medium. Background Art

[0002] TCP (Transmission Control Protocol) is a connection-oriented, reliable, byte-stream-based transport layer protocol. TCP ensures data integrity and accuracy through a series of features. TCP is widely used in network communications that require reliability, but these features of TCP also bring additional performance overhead and complexity, which limits its real-time communication and efficient transmission. For example, TCP requires a three-way handshake when connecting and a four-way handshake when disconnecting. Although this constraint ensures the stability of its data transmission, it greatly reduces the rate of real-time communication.

[0003] In the existing technology, TSO (TCP Segment Offload) technology is generally used to dynamically adjust the data packet size to adapt to the MTU (Maximum Transmission Unit) of different network segments, reduce the performance loss caused by IP (Internet Protocol) layer fragmentation, reduce latency, and improve the overall performance of network communications.

[0004] However, when TCP packets are segmented and unloaded, the complete IP header and TCP header are saved, such as Figure 1 As shown in the figure, a complete TCP data packet will be segmented into multiple smaller segment messages according to the MSS (Maximum Segment Size). The TCP frame header of each segment message is as follows Figure 2 As shown in the figure, when sending each segment message, Figure 2 The TCP frame header shown is retransmitted, which greatly reduces the data transmission rate. Summary of the invention

[0005] The present invention provides a TCP message encapsulation method, device, electronic device and storage medium, which are used to solve the defect of low data transmission rate in the prior art, effectively reduce the header overhead and improve the data transmission rate.

[0006] The present invention provides a TCP message encapsulation method, comprising: Receive a TCP message sent by the CPU of the local end, and when a communication connection is established between the opposite end and the local end, segment the TCP message into at least two first segment messages; Optimizing the redundant fields in each of the first segmented messages to determine each of the first encapsulated messages; For each of the first encapsulated messages, a second encapsulated message corresponding to the first encapsulated message is determined based on the verification status data corresponding to the local end; the verification status data is used to indicate whether the first encapsulated message enables verification and unloading.

[0007] According to the TCP message encapsulation method provided by the present invention, the redundant field includes a source port and a destination port; The optimizing the redundant fields in each of the first segmented messages to determine each of the first encapsulated messages includes: Acquire the source port and the destination port confirmed by the peer end and the local end during the communication process; For each of the first segmented messages, in the TCP frame header of the first segmented message, the source port and the destination port are deleted to determine the second segmented message; based on the segment type corresponding to the second segmented message, the first encapsulation message is determined; the segment type is used to characterize the position of the second segmented message in the TCP message.

[0008] According to the TCP message encapsulation method provided by the present invention, the redundant field also includes a confirmation number; The determining the first encapsulation message based on the segment type corresponding to the second segment message includes: When the segment type corresponding to the second segment message is a first segment message, determining the second segment message as the first encapsulation message; In the case that the segment type corresponding to the second segment message is a non-first segment message, the confirmation number is deleted from the TCP frame header of the second segment message to obtain the first encapsulation message.

[0009] According to the TCP message encapsulation method provided by the present invention, the determining, based on the verification status data corresponding to the local end, the second encapsulation message corresponding to the first encapsulation message includes: In a case where the check status data indicates that the local end enables checksum offloading, determining a checksum corresponding to the first encapsulated message, and updating a TCP frame header of the first encapsulated message based on the checksum to obtain a second encapsulated message; When the verification status data indicates that the local end does not enable verification and unloading, the first encapsulation message is determined as the second encapsulation message.

[0010] According to the TCP message encapsulation method provided by the present invention, the determining the checksum corresponding to the first encapsulation message includes: Based on the pseudo header corresponding to the first encapsulation message, a checksum corresponding to the first encapsulation message is determined.

[0011] According to the TCP message encapsulation method provided by the present invention, the method further includes: The second encapsulated messages are sent to the opposite end in sequence according to the segmentation order of the second encapsulated messages.

[0012] The present invention also provides a TCP message encapsulation device, comprising: A receiving module, used for receiving a TCP message sent by the CPU of the local end, and segmenting the TCP message into at least two first segment messages when a communication connection is established between the opposite end and the local end; An optimization module, configured to optimize the redundant fields in each of the first segmented messages and determine each of the first encapsulated messages when a communication connection is established between the opposite end and the local end; A determination module is used to determine, for each of the first encapsulation messages, the second encapsulation message corresponding to the first encapsulation message based on the verification status data corresponding to the local end; the verification status data is used to indicate whether the first encapsulation message enables verification and unloading.

[0013] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, any of the above-mentioned TCP message encapsulation methods is implemented.

[0014] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the TCP message encapsulation method described in any one of the above is implemented.

[0015] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned TCP message encapsulation methods.

[0016] The TCP message encapsulation method, device, electronic device and storage medium provided by the present invention segment a TCP message sent by a processor of a local end to obtain at least two first segment messages, and optimize redundant fields in each first segment message when a communication connection is established between the opposite end and the local end to obtain an optimized first encapsulation message. At the same time, according to the verification status data of whether verification and unloading are enabled configured in the local end, the encapsulation mode of each first encapsulation message is optimized to obtain an optimized second encapsulation message, thereby reducing the header overhead in each second encapsulation message and avoiding repeated transmission of redundant fields, thereby improving the real-time transmission efficiency of data. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0018] Figure 1 It is a schematic diagram of segmentation unloading of TCP data packets provided by the prior art.

[0019] Figure 2 It is a schematic diagram of a TCP frame header of a segmented message provided by the prior art.

[0020] Figure 3 It is a flow chart of the TCP message encapsulation method provided by an embodiment of the present invention.

[0021] Figure 4 It is a schematic diagram of the data transmission process provided by an embodiment of the present invention.

[0022] Figure 5 It is a schematic diagram of a TCP frame header enabling checksum offloading provided by an embodiment of the present invention.

[0023] Figure 6 It is a schematic diagram of a second encapsulation message enabling checksum offloading provided by an embodiment of the present invention.

[0024] Figure 7 It is a schematic diagram of a second encapsulated message without checksum offloading enabled provided by an embodiment of the present invention.

[0025] Figure 8 It is a structural schematic diagram of a TCP message encapsulation device provided by an embodiment of the present invention.

[0026] Fig. 9 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0028] In view of the problem of low data transmission rate in the prior art, an embodiment of the present invention provides a TCP message encapsulation method. Figure 3 Schematic diagram of the process of TCP message encapsulation method provided by the embodiment of the present invention, such as Figure 3 As shown, the TCP message encapsulation method includes the following steps 310 to 330.

[0029] Step 310: Receive a TCP message sent by the CPU of the local end, and when a communication connection is established between the opposite end and the local end, segment the TCP message into at least two first segment messages.

[0030] Specifically, after the electronic device receives a TCP message sent by the CPU in the local end and a communication connection is established between the opposite end and the local end, if the TCP message exceeds the MTU (Maximum Transmission Unit) of the network segment, the electronic device may segment the TCP message according to the MSS (Maximum Segment Size) negotiated during the communication between the opposite end and the local end to obtain at least two first segment messages. The MSS may be understood as the most suitable data block size for transmission during data transmission. Segmentation may better adapt to the network environment, reduce the load of a single first segment message transmission, improve network throughput, and achieve reliable data transmission.

[0031] It should be noted that the TCP message encapsulation method provided in the embodiment of the present invention is applied to an electronic device in the local end, which may include a network interface card or other hardware device, and the electronic device is connected to the CPU in the local end. The local end may be a client or a server end. When the local end is a client end, the opposite end is a server end. Conversely, when the local end is a server end, the opposite end is a client end.

[0032] Figure 4 is a schematic diagram of a data transmission process provided by an embodiment of the present invention, such as Figure 4 As shown, before the local end segments the TCP message, the data transmission includes the following steps.

[0033] S1. The application layer issues instructions, and the CPU in this end executes the instructions issued by the application program and prepares the data to be sent.

[0034] S2. The data to be sent is encapsulated by the presentation layer and the session layer and then sent to the transport layer. The transport layer encapsulates the data to be sent using TCP (Transmission Control Protocol) and adds necessary TCP header information to the data to be sent. The TCP header information may include source port number, destination port number, sequence number, length, etc. The data to be sent with the added TCP header information is then transmitted to the network layer.

[0035] S3. The network layer adds IP (Internet Protocol) header information to the TCP header information of the data to be sent to form a TCP message. The IP header information may include information such as the source IP address and the destination IP address. After that, the network layer passes the TCP message to the link layer. In the link layer, the electronic device adds a MAC (Media Access Control Address) frame header to the IP header information of the TCP message sent down. The MAC frame header may include information such as the source MAC address, the destination MAC address, the type field, and the CRC (Cyclic Redundancy Check) field. After that, the TCP message with the MAC frame header added is passed to the physical layer to communicate with the other end on the Ethernet medium.

[0036] S4, the local end and the remote end establish a communication connection through the "three-way handshake" in TCP. During the "three-way handshake", the remote end and the local end will negotiate some communication parameters, which at least include some fields in the redundant field and MSS. The three-way handshake actually provides the parameter basis for subsequent data segmentation.

[0037] Step 320: Optimize the redundant fields in each of the first segmented messages to determine each first encapsulated message.

[0038] Specifically, since the redundant fields in each first segment message are the same, each first encapsulation message is obtained by optimizing the redundant fields in each first segment message, and repeated transmission of the redundant fields is avoided by reducing the header overhead in each first segment message.

[0039] Further, the redundant field includes a source port and a destination port; The optimizing the redundant fields in each of the first segmented messages to determine each of the first encapsulated messages includes: Acquire the source port and the destination port confirmed by the peer end and the local end during the communication process; For each of the first segmented messages, in the TCP frame header of the first segmented message, the source port and the destination port are deleted to determine the second segmented message; based on the segment type corresponding to the second segmented message, the first encapsulation message is determined; the segment type is used to characterize the position of the second segmented message in the TCP message.

[0040] Specifically, since the peer end and the local end have obtained each other's source port and destination port during the "three-way handshake", in order to avoid repeated transmission of the source port and the destination port, the source port and the destination port in the TCP frame header of each first segment message can be deleted to obtain the second segment message after optimizing the TCP frame header. Afterwards, according to the segment type of each second segment message, that is, according to the position of each second segment message in the TCP message, the TCP frame header of each second segment message is continuously optimized to obtain each optimized first encapsulation message.

[0041] Furthermore, the redundant field also includes a confirmation number; The determining the first encapsulation message based on the segment type corresponding to the second segment message includes: When the segment type corresponding to the second segment message is a first segment message, determining the second segment message as the first encapsulation message; In the case that the segment type corresponding to the second segment message is a non-first segment message, the confirmation number is deleted from the TCP frame header of the second segment message to obtain the first encapsulation message.

[0042] Specifically, since each second segment message belongs to the same TCP message, the confirmation number of each second segment message is the same, and the confirmation number can be a response to the previous request. Therefore, for each second segment message, if the second segment message is the first segment message of the TCP message, the confirmation number can be retained in the TCP frame header of the first segment message, that is, the second segment message is directly confirmed as the first encapsulation message. If the second segment message is a non-first segment message in the TCP message, the confirmation number in the TCP frame header of the non-first segment message can be deleted, and the confirmation number of the first segment message can be shared, so that the same confirmation number does not need to be repeatedly sent during the transmission of each non-first segment message.

[0043] For example, Figure 2 Taking the TCP frame header shown in the figure as an example, after deleting the source port, destination port and confirmation number, the TCP frame header can be optimized from a fixed 20 bytes to 12 bytes, reducing the TCP frame header overhead by 40%.

[0044] Step 330: For each of the first encapsulated messages, determine the second encapsulated message corresponding to the first encapsulated message based on the verification status data corresponding to the local end; the verification status data is used to indicate whether the first encapsulated message enables verification and unloading.

[0045] Specifically, after determining each first encapsulated message, the verification status data configured in the local end can be determined, and through the verification status data, it can be determined whether the local end supports verification and unloading. Through the verification status data, the TCP frame header of each first encapsulated message can be further optimized to obtain the optimized second encapsulated message.

[0046] It should be noted that checksum offloading is an effective technology to improve network performance. It transfers the checksum calculation and verification tasks of data packets from the CPU to the electronic device and uses hardware acceleration to quickly complete the checksum generation and verification, thereby reducing the delay in the data transmission process, effectively reducing the burden on the CPU and improving the communication efficiency of the network.

[0047] Further, the determining, based on the verification status data corresponding to the local end, a second encapsulation message corresponding to the first encapsulation message includes: In a case where the check status data indicates that the local end enables checksum offloading, determining a checksum corresponding to the first encapsulated message, and updating a TCP frame header of the first encapsulated message based on the checksum to obtain a second encapsulated message; When the verification status data indicates that the local end does not enable verification and unloading, the first encapsulation message is determined as the second encapsulation message.

[0048] Specifically, if it is determined based on the verification status data that the local end supports checksum unloading, the electronic device calculates the checksum of the first encapsulated message and verifies it, and inserts the checksum value into the checksum field in the TCP frame header of the first encapsulated message to obtain an optimized second encapsulated message. If it is determined based on the verification status data that the local end does not support checksum unloading, there is no need to further optimize the first encapsulated message, and the first encapsulated message can be directly determined as the second encapsulated message.

[0049] Further, the determining a checksum corresponding to the first encapsulation message includes: Based on the pseudo header corresponding to the first encapsulation message, a checksum corresponding to the first encapsulation message is determined.

[0050] Specifically, if the local end supports checksum offloading, the pseudo header corresponding to each first encapsulated message can be obtained, and the pseudo header can include the source IP address, the destination IP address, the padding field, the protocol number, and the TCP message length, etc. Each first encapsulated message belongs to the same TCP message, so the pseudo headers of each first encapsulated message are the same. After determining the pseudo header of each first encapsulated message, the checksum of each first encapsulated message can be calculated based on the pseudo header.

[0051] For example, Figure 5 is a schematic diagram of a TCP frame header enabling checksum offloading provided by an embodiment of the present invention, Figure 6 Schematic diagram of a second encapsulated message with checksum offloading enabled provided by an embodiment of the present invention. If the local end enables checksum offloading, the redundant field is deleted, and the TCP frame header of the second encapsulated message after the checksum is inserted is as follows: Figure 5 As shown, the complete second encapsulation message is as follows Figure 6As shown. Wherein, EH represents the Ethernet frame header, IPH represents the IP frame header, CRC represents the Ethernet checksum, TPi represents the i-th TCP load segment data, the TCP load segment data of all second encapsulated messages can constitute the TCP load data of the TCP message, and i is a positive integer less than n, n represents the number of all second encapsulated messages, and THLC represents the TCP frame header with checksum offloading enabled.

[0052] In addition, if the local end does not enable checksum offloading, the TCP frame header and Figure 5 The TCP frame header shown differs in that the checksum field is empty. Figure 7 Schematic diagram of a second encapsulated message without enabling checksum offloading provided by an embodiment of the present invention, and the obtained complete second encapsulated message is as follows Figure 7 As shown, THL represents a TCP frame header without checksum offloading enabled.

[0053] It should be noted that the checksum is used to detect whether an error occurs in the transmission process of each first encapsulated message, and the checksum is determined based on the pseudo header and TCP payload data. Therefore, although the pseudo headers of each first encapsulated message are the same, since the TCP payload data in each first encapsulated message is different, the calculated checksum values ​​of each first encapsulated message are different.

[0054] Furthermore, the method further comprises: The second encapsulated messages are sent to the opposite end in sequence according to the segmentation order of the second encapsulated messages.

[0055] Specifically, after determining each second encapsulation message, the electronic device may send each second encapsulation message to the opposite end in sequence according to the segmentation order of each second encapsulation message, so as to realize network communication between the local end and the opposite end.

[0056] The TCP message encapsulation method provided by the embodiment of the present invention obtains at least two first segmented messages by segmenting the TCP message sent by the CPU of the local end, and optimizes the redundant fields in each first segmented message when a communication connection is established between the opposite end and the local end to obtain an optimized first encapsulated message. At the same time, according to the verification status data of whether to enable verification and unloading configured in the local end, the encapsulation mode of each first encapsulated message is optimized to obtain an optimized second encapsulated message, thereby reducing the header overhead in each second encapsulated message, avoiding repeated transmission of redundant fields, and thus improving the real-time transmission efficiency of data.

[0057] The TCP message encapsulation device provided by the present invention is described below. The TCP message encapsulation device described below and the TCP message encapsulation method described above can be referred to each other.

[0058] The embodiment of the present invention also provides a TCP message encapsulation device, Figure 8 Schematic diagram of the structure of the TCP message encapsulation device provided by the embodiment of the present invention. Figure 8 As shown, the TCP message encapsulation device 800 includes: a receiving module 810, an optimizing module 820 and a determining module 830.

[0059] The receiving module 810 is used to receive a TCP message sent by the CPU of the local end, and segment the TCP message into at least two first segment messages when a communication connection is established between the opposite end and the local end; The optimization module 820 is used to optimize the redundant fields in each of the first segmented messages and determine each of the first encapsulated messages when the opposite end and the local end establish a communication connection; The determination module 830 is used to determine, for each of the first encapsulation messages, the second encapsulation message corresponding to the first encapsulation message based on the verification status data corresponding to the local end; the verification status data is used to indicate whether the first encapsulation message enables verification and unloading.

[0060] The TCP message encapsulation device provided by the embodiment of the present invention segments the TCP message sent by the CPU of the local end to obtain at least two first segmented messages, and optimizes the redundant fields in each first segmented message when a communication connection is established between the opposite end and the local end to obtain an optimized first encapsulated message. At the same time, according to the verification status data of whether to enable verification and unloading configured in the local end, the encapsulation method of each first encapsulated message is optimized to obtain an optimized second encapsulated message, thereby reducing the header overhead in each second encapsulated message, avoiding repeated transmission of redundant fields, and thus improving the real-time transmission efficiency of data.

[0061] Optionally, the redundant field includes a source port and a destination port.

[0062] Optionally, the optimization module 820 is specifically configured to: Acquire the source port and the destination port confirmed by the peer end and the local end during the communication process; For each of the first segmented messages, in the TCP frame header of the first segmented message, the source port and the destination port are deleted to determine the second segmented message; based on the segment type corresponding to the second segmented message, the first encapsulation message is determined; the segment type is used to characterize the position of the second segmented message in the TCP message.

[0063] Optionally, the redundant field also includes a confirmation number.

[0064] Optionally, the optimization module 820 is further configured to: When the segment type corresponding to the second segment message is a first segment message, determining the second segment message as the first encapsulation message; In the case that the segment type corresponding to the second segment message is a non-first segment message, the confirmation number is deleted from the TCP frame header of the second segment message to obtain the first encapsulation message.

[0065] Optionally, the determining module 830 is specifically configured to: In a case where the check status data indicates that the local end enables checksum offloading, determining a checksum corresponding to the first encapsulated message, and updating a TCP frame header of the first encapsulated message based on the checksum to obtain a second encapsulated message; When the verification status data indicates that the local end does not enable verification and unloading, the first encapsulation message is determined as the second encapsulation message.

[0066] Optionally, the determining module 830 is specifically configured to: Based on the pseudo header corresponding to the first encapsulation message, a checksum corresponding to the first encapsulation message is determined.

[0067] Optionally, the TCP message encapsulation device 800 further includes a sending module, and the sending module is specifically configured to: The second encapsulated messages are sent to the opposite end in sequence according to the segmentation order of the second encapsulated messages.

[0068] Fig. 9 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, such as Fig. 9 As shown, the electronic device may include: a processor 910, a communication interface 920, a memory 930 and a communication bus 940, wherein the processor 910, the communication interface 920 and the memory 930 communicate with each other through the communication bus 940. The processor 910 may call the logic instructions in the memory 930 to execute the TCP message encapsulation method, which includes: Receive a TCP message sent by the CPU of the local end, and when a communication connection is established between the opposite end and the local end, segment the TCP message into at least two first segment messages; Optimizing the redundant fields in each of the first segmented messages to determine each of the first encapsulated messages; For each of the first encapsulated messages, a second encapsulated message corresponding to the first encapsulated message is determined based on the verification status data corresponding to the local end; the verification status data is used to indicate whether the first encapsulated message enables verification and unloading.

[0069] In addition, the logic instructions in the above-mentioned memory 930 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0070] On the other hand, the present invention further provides a computer program product, the computer program product includes a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, when the computer program is executed by a processor, the computer can execute the TCP message encapsulation method provided by the above methods, the method comprising: Receive a TCP message sent by the CPU of the local end, and when a communication connection is established between the opposite end and the local end, segment the TCP message into at least two first segment messages; Optimizing the redundant fields in each of the first segmented messages to determine each of the first encapsulated messages; For each of the first encapsulated messages, a second encapsulated message corresponding to the first encapsulated message is determined based on the verification status data corresponding to the local end; the verification status data is used to indicate whether the first encapsulated message enables verification and unloading.

[0071] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to perform the TCP message encapsulation method provided by the above methods, the method comprising: Receive a TCP message sent by the CPU of the local end, and when a communication connection is established between the opposite end and the local end, segment the TCP message into at least two first segment messages; Optimizing the redundant fields in each of the first segmented messages to determine each of the first encapsulated messages; For each of the first encapsulated messages, a second encapsulated message corresponding to the first encapsulated message is determined based on the verification status data corresponding to the local end; the verification status data is used to indicate whether the first encapsulated message enables verification and unloading.

[0072] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0073] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0074] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A TCP message encapsulation method, characterized in that: include: Receive a TCP message sent by the CPU of the local end, and when a communication connection is established between the opposite end and the local end, segment the TCP message into at least two first segment messages; Optimizing the redundant fields in each of the first segmented messages to determine each of the first encapsulated messages; For each of the first encapsulated messages, determining a second encapsulated message corresponding to the first encapsulated message based on the verification status data corresponding to the local end; The verification status data is used to indicate whether verification and unloading are enabled for the first encapsulation message.

2. The TCP message encapsulation method according to claim 1, characterized in that: The redundant field includes a source port and a destination port; The optimizing the redundant fields in each of the first segmented messages to determine each of the first encapsulated messages includes: Acquire the source port and the destination port confirmed by the peer end and the local end during the communication process; For each of the first segmented messages, in the TCP frame header of the first segmented message, the source port and the destination port are deleted to determine the second segmented message; based on the segment type corresponding to the second segmented message, the first encapsulation message is determined; the segment type is used to characterize the position of the second segmented message in the TCP message.

3. The TCP message encapsulation method according to claim 2, characterized in that: The redundant field also includes a confirmation number; The determining the first encapsulation message based on the segment type corresponding to the second segment message includes: When the segment type corresponding to the second segment message is a first segment message, determining the second segment message as the first encapsulation message; In the case that the segment type corresponding to the second segment message is a non-first segment message, the confirmation number is deleted from the TCP frame header of the second segment message to obtain the first encapsulation message.

4. The TCP message encapsulation method according to any one of claims 1 to 3, characterized in that: The determining, based on the verification status data corresponding to the local end, a second encapsulation message corresponding to the first encapsulation message includes: In a case where the check status data indicates that the local end enables checksum offloading, determining a checksum corresponding to the first encapsulated message, and updating a TCP frame header of the first encapsulated message based on the checksum to obtain a second encapsulated message; When the verification status data indicates that the local end does not enable verification and unloading, the first encapsulation message is determined as the second encapsulation message.

5. The TCP message encapsulation method according to claim 4, characterized in that: The determining a checksum corresponding to the first encapsulation message includes: Based on the pseudo header corresponding to the first encapsulation message, a checksum corresponding to the first encapsulation message is determined.

6. The TCP message encapsulation method according to any one of claims 1 to 3, characterized in that: The method further comprises: The second encapsulated messages are sent to the opposite end in sequence according to the segmentation order of the second encapsulated messages.

7. A TCP message encapsulation device, characterized in that: include: A receiving module, used for receiving a TCP message sent by the CPU of the local end, and segmenting the TCP message into at least two first segment messages when a communication connection is established between the opposite end and the local end; An optimization module, configured to optimize the redundant fields in each of the first segmented messages and determine each of the first encapsulated messages when a communication connection is established between the opposite end and the local end; A determination module, configured to determine, for each of the first encapsulated messages, a second encapsulated message corresponding to the first encapsulated message based on the verification status data corresponding to the local end; The verification status data is used to indicate whether verification and unloading are enabled for the first encapsulation message.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the TCP message encapsulation method according to any one of claims 1 to 6 is implemented.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the TCP message encapsulation method according to any one of claims 1 to 6 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the TCP message encapsulation method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • TCP (transmission control protocol) message transmission method and TCP message receiving method and device

    CN102377651A

  • Message encapsulation / decapsulation device and method

    CN102447627A

  • Relay communication protocol method capable of changing header

    CN105915456A

  • Message data processing method and device, electronic equipment and storage medium

    CN117896451A

  • Method for un-packaging flexray packet and apparatuses using the same

    KR1020150050937A