Data transmission method and device, computer device, storage medium and program product
By receiving data packets, verifying them with checksums, deleting or correcting erroneous data, and generating new data packets, the problem of low data packet transmission efficiency in industrial Ethernet communication systems is solved, and transmission reliability and efficiency are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- XIAN HUICHUAN TECHNOLOGY R&D CENTER CO LTD
- Filing Date
- 2026-04-23
- Publication Date
- 2026-07-10
AI Technical Summary
In industrial Ethernet communication systems, existing store-and-forward and non-store-and-forward modes can lead to wasted network resources and low transmission efficiency when data packets are corrupted.
By receiving data packets and verifying them using their checksums, erroneous data packets are identified, deleted or corrected, new data packets are generated and sent or stored, thus preventing the continued transmission of erroneous data.
It improves the reliability and security of data packet transmission, reduces the network bandwidth and cache space occupied by invalid data, and improves transmission efficiency.
Smart Images

Figure CN122372497A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data transmission technology, and in particular to a data transmission method, apparatus, computer equipment, storage medium, and program product. Background Technology
[0002] In industrial Ethernet communication systems, packet forwarding modes can be divided into store-and-forward and non-store-and-forward. Store-and-forward requires error detection and forwarding of the packet after it has been fully stored; non-store-and-forward can initiate the forwarding process without storing the entire packet.
[0003] However, when data packets are corrupted, the aforementioned forwarding mode will continue to transmit the corrupted data packets to the receiving end, wasting network resources and resulting in low data packet transmission efficiency. Summary of the Invention
[0004] Therefore, it is necessary to provide a data transmission method, apparatus, computer equipment, storage medium, and program product that can improve the transmission efficiency of data packets, addressing the aforementioned technical problems.
[0005] Firstly, this application provides a data transmission method for a target node. The method includes:
[0006] Receive a first data packet, wherein the first data packet includes a first checksum;
[0007] The first data packet is verified based on the first verification code to obtain the verification result;
[0008] If the verification result is that the verification fails, a second data packet is determined based on the first data packet, and the second data packet is sent to the next node of the target node or stored.
[0009] In one embodiment, determining the second data packet based on the first data packet includes:
[0010] The first data packet is reduced in size to obtain a reduced data packet;
[0011] The preset bits in the second check code are flipped to obtain the target second check code, which is calculated based on the reduced data packet.
[0012] The second data packet is obtained by replacing the first checksum in the reduced data packet with the target second checksum.
[0013] In one embodiment, the first data packet further includes multiple data segments, each data segment including a third checksum. The step of performing data reduction processing on the first data packet to obtain a reduced data packet includes:
[0014] Calculate the fourth checksum for each target data segment, wherein the target data segment is the data segment that belongs to the preset key data segment among the plurality of data segments;
[0015] For each of the fourth check codes, determine whether the third check code included in the target data segment is consistent with the fourth check code;
[0016] If the third check code is inconsistent with the fourth check code, then the target data segment and the data between the target data segment and the first check code are deleted from the first data packet to obtain the reduced data packet;
[0017] If the third check code matches the fourth check code, then the first data packet is subjected to general data reduction processing to obtain the reduced data packet.
[0018] In one embodiment, performing general data reduction processing on the first data packet to obtain the reduced data packet includes:
[0019] The length of the first byte is determined based on the first data packet, and the length difference between the length of the first byte and the length of the second byte of the first check code is calculated. The length of the first byte is the length of the bytes of data stored during transmission.
[0020] The reduced data packet is obtained by deleting bits of the specified length difference bytes forward from the target bit in the first data packet, where the target bit is the bit preceding the start bit of the first checksum.
[0021] In one embodiment, the method further includes:
[0022] Determine the length of the third byte of the first data packet;
[0023] The step of verifying the first data packet based on the first checksum to obtain a verification result includes:
[0024] If the length of the third byte is greater than a preset length threshold, the first data packet is verified according to the first checksum to obtain a verification result.
[0025] In one embodiment, the method further includes:
[0026] If the length of the third byte is less than the length threshold, the first data packet is deleted.
[0027] In one embodiment, the step of verifying the first data packet based on the first checksum to obtain a verification result includes:
[0028] Calculate the second checksum corresponding to the first data packet;
[0029] If the first verification code and the second verification code are inconsistent, the verification result is determined to be a verification failure.
[0030] If the first verification code matches the second verification code, then the verification result is determined to be successful.
[0031] In one embodiment, the target node is a receiving node, and the method further includes:
[0032] If the first checksum and the second checksum are inconsistent, the damage type of the first data packet is determined based on the first checksum and the second checksum.
[0033] In one embodiment, determining the damage type of the first data packet based on the first checksum and the second checksum includes:
[0034] Determine whether there is a flip relationship between the preset bits in the second check code and the preset bits in the first check code;
[0035] If the preset bits in the second check code are flipped relative to the preset bits in the first check code, then the damage type is determined to be damage during data transmission.
[0036] If the preset bits in the second check code do not have a flip relationship with the preset bits in the first check code, then it is determined that the damage type was damaged during data reception.
[0037] Secondly, this application also provides a data transmission apparatus for a target node. The apparatus includes:
[0038] A receiving module is used to receive a first data packet, wherein the first data packet includes a first checksum;
[0039] The verification module is used to verify the first data packet according to the first verification code and obtain the verification result;
[0040] The first determining module is configured to, in the case that the verification result is that the verification fails, determine the second data packet based on the first data packet, and send the second data packet to the next node of the target node or store the second data packet.
[0041] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the method described in the first aspect.
[0042] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of the method described in the first aspect.
[0043] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the steps of the method described in the first aspect.
[0044] In the aforementioned data transmission method, apparatus, computer equipment, computer-readable storage medium, and computer program product, the target node first receives a first data packet, which includes a first checksum. Then, the target node verifies the first data packet based on the first checksum to obtain a verification result. If the verification result is a failure, i.e., the first data packet is an erroneous data packet, a second data packet can be determined based on the first data packet. The second data packet can then be sent to the next node of the target node or stored. This avoids sending the erroneous first data packet to the next node, reducing the network bandwidth usage of invalid data. Alternatively, it avoids storing the erroneous first data packet, reducing the cache space usage of invalid data. This improves the reliability and security of the data packet transmission process, reduces the frequency of data packet retransmission, and ultimately improves the data packet transmission efficiency. Attached Figure Description
[0045] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0046] Figure 1 This is an application environment diagram of a data transmission method in one embodiment;
[0047] Figure 2 This is a flowchart illustrating a data transmission method in one embodiment;
[0048] Figure 3 This is a flowchart illustrating step 203 in one embodiment;
[0049] Figure 4This is a schematic diagram of bit flipping processing in one embodiment;
[0050] Figure 5 This is a flowchart illustrating step 301 in one embodiment;
[0051] Figure 6 This is a schematic diagram of data reduction processing in one embodiment;
[0052] Figure 7 This is a flowchart illustrating the data transmission method in another embodiment;
[0053] Figure 8 This is a schematic diagram of data reduction processing in another embodiment;
[0054] Figure 9 This is a schematic diagram illustrating the byte length of a data packet in one embodiment;
[0055] Figure 10 This is a flowchart illustrating step 202 in one embodiment;
[0056] Figure 11 This is a flowchart illustrating the data transmission method in another embodiment;
[0057] Figure 12 This is a structural block diagram of a data transmission device in one embodiment;
[0058] Figure 13 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0059] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0060] In data forwarding modes, such as switch cut-through forwarding and industrial Ethernet real-time forwarding, a non-store-and-forward mode is typically used. The core characteristic of this mode is "receive and forward simultaneously," meaning the forwarding process can begin without storing the entire data packet. In this mode, erroneous data packets can only be identified and discarded when they reach the receiving end. Industrial Ethernet systems like Profinet and EtherCAT use a "real-time forwarding" mechanism, which triggers erroneous data packet detection during the forwarding process (e.g., an intermediate node discovers a checksum error during forwarding). Even when an erroneous data packet is detected, the complete data packet still needs to be forwarded. Therefore, the non-store-and-forward mode leads to invalid data consuming network bandwidth.
[0061] In store-and-forward mode, the core characteristic is that forwarding decisions and error detection can only be performed after the entire data packet is stored. In this mode, erroneous data packets can be identified and discarded at intermediate nodes in the forwarding process. However, while this store-and-forward mode can avoid invalid forwarding, it wastes network buffer and bandwidth resources, which has a significant negative impact on network performance and is not friendly to real-time networks.
[0062] In addition, in the two data forwarding modes mentioned above, erroneous data packets are discarded during the forwarding process in the store-and-forward scenario, making it impossible to continue transmitting information. Furthermore, in the non-store-and-forward scenario, there is no ability to mark the stage where the error occurs. Therefore, the above forwarding modes suffer from low data packet transmission efficiency.
[0063] In view of this, this application proposes a data transmission method that simultaneously supports both store-and-forward and non-store-and-forward scenarios to improve data packet transmission efficiency.
[0064] The data transmission method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, target node 102 communicates with other nodes 104 via a network. A first data storage system can store the data that target node 102 needs to process; this system can be integrated onto target node 102 or located in the cloud or on another network server. A second data storage system can store the data that other nodes 104 need to process; this system can be integrated onto other nodes 104 or located in the cloud or on another network server. Target node 102 first receives a first data packet sent by other nodes 104, which includes a first checksum. Then, it verifies the first data packet based on the first checksum to obtain a verification result. If the verification result is a failure, it determines a second data packet based on the first data packet and sends the second data packet to the next node of the target node or stores the second data packet.
[0065] Optionally, target node 102 can be a terminal, or it can also be a server. Optionally, other nodes 104 can be terminals, or they can also be servers. For example, when target node 102 and / or other nodes 104 are terminals, they can be, but are not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can be smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. Portable wearable devices can be smartwatches, smart bracelets, head-mounted devices, etc. Alternatively, when target node 102 and / or other nodes 104 are servers, they can be implemented using independent servers or a server cluster composed of multiple servers.
[0066] In one exemplary embodiment, such as Figure 2 As shown, a data transmission method is provided, which is applied to... Figure 1 Taking the target node in the example, the explanation includes the following steps:
[0067] Step 201: Receive the first data packet.
[0068] The first data packet includes a first checksum. The first checksum is the checksum added to the first data packet by the previous neighboring node of the target node.
[0069] It should be noted that in multi-node data transmission, data packets need to be sent from the sending node, forwarded through multiple intermediate nodes, and finally transmitted to the receiving node. Optionally, an intermediate node may include one node, or it may include multiple intermediate nodes. Therefore, in this embodiment, the target node may be one of the intermediate nodes, or it may be the receiving node.
[0070] Optionally, if the target node is the next node after the sending node, the first checksum is the checksum calculated by the sending node and added to the first data packet; if the target node is a node that is not adjacent to the sending node, the first checksum is the checksum calculated by the previous node of the target node and added to the first data packet.
[0071] In this embodiment, the target node can receive the first data packet from the sending node or other intermediate node via the network.
[0072] Step 202: Verify the first data packet according to the first check code to obtain the verification result.
[0073] The verification result refers to whether the first data packet was damaged or corrupted during transmission. Optionally, the verification result can be either "verification passed" or "verification failed".
[0074] In this embodiment, the target node can use a preset standard check code to verify the first check code and obtain the verification result.
[0075] Optionally, if the first check code matches the standard check code, the verification result can be determined as verification passed; or, if the first check code does not match the standard check code, the verification result can be determined as verification failed.
[0076] Step 203: If the verification result is that the verification fails, determine the second data packet based on the first data packet, and send the second data packet to the next node of the target node or store the second data packet.
[0077] The second data packet is the data packet obtained by the target node after processing the first data packet. It is understandable that, in order to reduce the transmission of invalid data, the target node can delete erroneous data from the first data packet if the verification fails, or it can add an error marker to the first data packet to allow subsequent nodes to quickly determine whether the first data packet is corrupted.
[0078] It should be noted that if the target node is an intermediate node, the second data packet can be sent to the next node after the target node; if the target node is a receiving node, the second data packet can be stored.
[0079] In this embodiment, if the verification result is that the verification fails, the target node can process the first data packet using the corresponding processing rules to obtain the second data packet, and then send the second data packet to the next node of the target node or store the second data packet.
[0080] In the aforementioned data transmission method, the target node first receives a first data packet, which includes a first checksum. Then, it verifies the first data packet based on the first checksum to obtain a verification result. If the verification result is a failure, i.e., the first data packet is an erroneous data packet, a second data packet can be determined based on the first data packet. This second data packet can then be sent to the next node of the target node or stored. This avoids sending the erroneous first data packet to the next node, reducing the network bandwidth usage of invalid data. Alternatively, it avoids storing the erroneous first data packet, reducing the cache space usage of invalid data. This improves the reliability and security of the data packet transmission process, reduces the frequency of data packet retransmission, and ultimately improves the data packet transmission efficiency.
[0081] In the above Figure 2Based on the illustrated embodiments, in an exemplary embodiment, such as Figure 3 As shown, this embodiment relates to the process by which the target node determines the second data packet based on the first data packet. Step 203 above includes:
[0082] Step 301: Perform data reduction processing on the first data packet to obtain a reduced data packet.
[0083] It should be noted that if the verification result is that the verification fails, it can be determined that the first data packet is corrupted, that is, there is erroneous data in the first data packet. Therefore, in order to avoid continuing to transmit erroneous data, occupying bandwidth and wasting network resources, erroneous data can be removed from the first data packet.
[0084] Data reduction processing refers to removing erroneous data from the first data packet. Reduced data packets refer to the data packets obtained after performing data reduction processing on the first data packet.
[0085] It is understandable that in the first data packet, the later the decision information for deciding the forwarding port is in the first data packet, the more fields need to be temporarily stored in the target node during transmission, and the more bytes are stored. Optionally, the more bytes are stored, the greater the data reduction of the first data packet.
[0086] In this embodiment, the target node can first determine the bit corresponding to the erroneous data in the first data packet, then delete the bit corresponding to the erroneous data from the first data packet, and then obtain the reduced data packet.
[0087] Step 302: Perform bit flipping on the preset bits in the second check code to obtain the target second check code.
[0088] The second checksum is calculated based on the reduced data packet. It is understood that the algorithm for calculating the second checksum is the same as the algorithm for calculating the first checksum; for example, this algorithm could be a Frame Check Sequence (FCS) algorithm, or it could be a Cyclic Redundancy Check (CRC) algorithm.
[0089] Bit flipping refers to changing a bit from 0 to 1, or from 1 to 0. To mark an erroneous first data packet, the bits that need bit flipping can be pre-specified, and the error mark can be obtained by flipping the preset bits. For example, the last two bits of the checksum can be specified as the preset bits.
[0090] Among them, the second check code after bit flipping is the target second check code.
[0091] In this embodiment, the target node can use a check code algorithm to calculate the second check code corresponding to the reduced data packet, and then perform bit flipping on the preset bits in the second check code to obtain the target second check code.
[0092] Step 303: Replace the first checksum in the reduced data packet with the target second checksum to obtain the second data packet.
[0093] The second data packet refers to the data packet obtained after the checksum has been replaced. It can be understood that, compared to the first data packet, the second data packet cached in the target node does not contain erroneous data, and the second data packet includes the latest checksum.
[0094] In this embodiment, the target node can first delete the first checksum from the reduced data packet, then add the target second checksum to the reduced data packet, and then identify the reduced data packet after the addition as the second data packet.
[0095] For example, such as Figure 4 The image shows a schematic diagram of bit flipping processing. Please refer to [link / reference]. Figure 4 If the target node is node 2, and the first checksum in the first data packet received by node 2 includes 4 bits, and the last two bits are preset bits, then after obtaining the second checksum, node 2 can perform bit flipping on bytes 3 and 4 in the second checksum to obtain the target second checksum. Then, it can delete the first checksum in the first data packet and add the target second checksum to the first data packet to obtain the second data packet.
[0096] In this embodiment, the target node first performs data reduction processing on the first data packet, removing invalid data to obtain a reduced data packet, effectively simplifying the data size of the data packet. Then, based on the preset bits in the second checksum calculated from the reduced data packet, it performs bit flipping processing to quickly generate the target second checksum. Subsequently, the target second checksum replaces the first checksum in the reduced data packet to obtain the second data packet. On the one hand, the target second checksum is efficiently obtained through bit flipping processing without complex calculations, shortening the checksum generation time and improving the processing efficiency of the first data packet. On the other hand, replacing the first checksum with the target second checksum allows the second data packet to carry an indication that the first data packet has an error, eliminating the need for an additional independent error flag field, further simplifying the data packet structure, and thus improving the efficiency of data transmission and data verification.
[0097] Based on any of the above embodiments, Figure 3 The illustrated embodiment is an example; in one exemplary embodiment, such as... Figure 5As shown, the first data packet also includes multiple data segments, each containing a third checksum. This embodiment relates to how the target node performs data reduction processing on the first data packet to obtain a reduced data packet. Step 301 above includes:
[0098] Step 501: Calculate the fourth checksum for each target data segment.
[0099] The target data segment is a data segment that belongs to the preset key data segment among multiple data segments.
[0100] It should be noted that the data structure of the first data packet can be found in [link to previous text]. Figure 4 The first data packet may include multiple data segments. For example, the data segments may be critical data segments that carry key information during the data transmission process, such as header length data segments, total data packet length data segments, and destination address data segments of the receiving node. The data segments may also be non-critical data segments, such as business data segments and redundant data segments.
[0101] When performing data reduction on the first data packet, to improve the accuracy of data reduction and refine the granularity of data reduction, it can be determined whether each data segment needs to be reduced. The fourth checksum refers to the checksum corresponding to each target data segment belonging to the critical data segment.
[0102] In this embodiment, the target node can first divide the first data packet into data segments, then determine the target data segments that belong to the critical data segments, and then calculate the fourth check code for each target data segment.
[0103] Step 502: For each fourth check code, determine whether the third check code and the fourth check code included in the target data segment are consistent.
[0104] The third checksum is a checksum carried in each target data segment. The algorithm for calculating the fourth checksum is the same as the algorithm for calculating the third checksum.
[0105] It is understandable that the process of determining whether each third check code matches the corresponding fourth check code is the same. Therefore, the process will be described exemplarily using a fourth check code as an example.
[0106] In this embodiment, for the fourth check code corresponding to each target data segment, the target node can obtain the third check code from the target data segment, and then compare the third check code and the fourth check code to obtain the comparison result. Based on the comparison result, it is determined whether the third check code and the fourth check code are consistent.
[0107] Step 503: If the third check code and the fourth check code are inconsistent, then delete the target data segment and the data between the target data segment and the first check code from the first data packet to obtain a reduced data packet.
[0108] In this embodiment, if the comparison result indicates that the third check code and the fourth check code are inconsistent, the target node can determine that there is erroneous data in the same target data segment corresponding to the third check code and the fourth check code, and delete the target data segment and the data between the target data segment and the first check code from the first data packet. Thus, after deleting all the target data segments corresponding to the third check code and the fourth check code, as well as the data between the target data segment and the first check code, the other data in the first data packet can be encapsulated to obtain a reduced data packet.
[0109] For example, such as Figure 6 The image shown is a schematic diagram of a data reduction process. Please refer to [link / reference]. Figure 6 The target node can delete the target data segment in the first data packet, as well as the data between the target data segment and the first checksum.
[0110] Step 504: If the third check code matches the fourth check code, then perform general data reduction processing on the first data packet to obtain a reduced data packet.
[0111] In this embodiment, if the comparison result shows that the third check code and the fourth check code are consistent, the target node can determine that there is no erroneous data in the same target data segment corresponding to the third check code and the fourth check code. Therefore, the non-target data segment data in the first data packet can be deleted by using general data reduction processing to obtain a reduced data packet.
[0112] In this embodiment, the target node first calculates the fourth checksum of each target data segment of the preset key data segment. Then, for each fourth checksum, it determines whether the third checksum included in the target data segment is consistent with the fourth checksum. If the third checksum and the fourth checksum are inconsistent, the first data packet is reduced based on the third checksum to obtain a reduced data packet. This allows for targeted deletion of key data segments, reducing the confusion caused by errors in key data during subsequent data packet parsing. Furthermore, if the third checksum and the fourth checksum are consistent, a general data reduction process is performed on the first data packet, improving the efficiency of data reduction and obtaining a reduced data packet. Thus, different data reduction processes can be applied to the first data packet for different situations, improving the effectiveness of data reduction processing and thereby improving the efficiency of data transmission.
[0113] Based on any of the above embodiments, Figure 5 The illustrated embodiment is an example; in one exemplary embodiment, such as... Figure 7 As shown, this embodiment relates to the process by which the target node performs general data reduction processing on the first data packet to obtain a reduced data packet. This process includes:
[0114] Step 701: Determine the length of the first byte based on the first data packet, and calculate the length difference between the length of the first byte and the length of the second byte of the first checksum.
[0115] The first byte length refers to the length of the data stored during transmission, that is, the amount of storage space occupied by the data during transmission. The second byte length refers to the amount of storage space occupied by the first checksum. For example, if the second byte length is 1 byte, then the first checksum occupies 8 bits of data packet space.
[0116] In this embodiment, the target node can determine the length of the first byte by reading the space occupied by the first data packet during transmission, and determine the length of the second byte by reading the memory space occupied by the first check code. Then, the length difference is obtained by subtracting the length of the second byte from the length of the first byte.
[0117] Step 702: Starting from the target bit in the first data packet, delete bits with a length difference of bytes forward to obtain a reduced data packet.
[0118] The target bit is the bit preceding the start bit of the first check code.
[0119] In this embodiment, the target node can first determine the bit preceding the start bit of the first checksum in the first data packet. This preceding bit is determined as the target bit. The target node also determines the initial bit of the non-critical data field in the first data packet. Then, all bits between the initial bit of the non-critical data field and the target bit are deleted.
[0120] For example, such as Figure 8 The image shows a schematic diagram of another data reduction process. Please refer to [link / reference]. Figure 8 If the first checksum and the second checksum are inconsistent, and there is no erroneous data in the critical data segment, the target node can determine that there is erroneous data between the initial bit and the target bit of the non-critical data field, and thus delete this part of the data. For example, if the second byte is n bytes long and the first byte is 4 bytes long, then starting from the bit before the start bit of the first checksum in the first data packet, (n-4) bytes of data are deleted backwards.
[0121] In this embodiment, the target node determines the length of the first byte based on the first data packet, calculates the length difference between the length of the first byte and the length of the second byte of the first check code, then determines the bit before the start bit of the first check code in the first data packet as the target bit, and deletes bits of length difference bytes forward from the target bit, thereby deleting the data segment containing erroneous data from the first data packet, ensuring that there is no erroneous data in the data packets transmitted later, thereby reducing the frequency of data packet retransmission and improving data packet transmission efficiency.
[0122] In the above Figure 2 Based on the illustrated embodiment, in an exemplary embodiment, the above method further includes: determining the length of the third byte of the first data packet.
[0123] The length of the third byte refers to the length of all the data in the first data packet when the target node receives it.
[0124] It should be noted that in the data transmission method provided in this application embodiment, the target node can remove erroneous data from the first data packet. If, after removal, the data length of the first data packet is less than the minimum Ethernet frame length, then the first data packet carries very little effective data. If the first data packet is continued to be transmitted, it will result in a waste of resources. Therefore, the first data packet can be processed only if its data length is greater than the minimum Ethernet frame length.
[0125] Step 202 above includes: when the length of the third byte is greater than a preset length threshold, verifying the first data packet according to the first check code to obtain the verification result.
[0126] The length threshold refers to the critical value for the length of the first data packet transmitted. For example, the length threshold could be the minimum Ethernet frame length, which could be 64 bytes.
[0127] In this embodiment, the target node can compare the length of the third byte with the length threshold. If the length of the third byte is greater than the preset length threshold, the first data packet can be verified according to the first check code to obtain the verification result. Thus, the first data packet can be determined as damaged based on the verification result.
[0128] In some embodiments, the above method further includes: deleting the first data packet if the length of the third byte is less than a length threshold.
[0129] Understandably, if the length of the third byte is less than the length threshold, the target node may delete the first data packet to avoid wasting resources and reduce bandwidth usage.
[0130] For example, such as Figure 9 As shown, taking node 2 as the target node, the length of the third byte of the first data packet received by node 2 includes the space occupied by each critical data segment, non-critical data segment, and the first checksum.
[0131] In this embodiment, by determining the length of the third byte of the first data packet, the target node can verify the first data packet according to the first check code when the length of the third byte is greater than the preset length threshold, and obtain the verification result. This avoids the problem of wasting resources by processing the first data packet when the length of the third byte is less than the length threshold and does not meet the data transmission requirements.
[0132] In the above Figure 2 Based on the illustrated embodiments, in an exemplary embodiment, such as Figure 10 As shown, this embodiment relates to the process by which the target node verifies the first data packet based on the first checksum and obtains the verification result. Step 202 above includes:
[0133] Step 1001: Calculate the second checksum corresponding to the first data packet.
[0134] In this embodiment, the target node can calculate the second check code using the check code algorithm corresponding to the first check code for all data in the first data packet.
[0135] Step 1002: If the first verification code and the second verification code are inconsistent, the verification result is determined to be that the verification failed.
[0136] In this context, "verification failed" means that the first data packet was corrupted.
[0137] In this embodiment, the target node can compare the first check code and the second check code. If the comparison result is inconsistent, it means that the first check code and the second check code are inconsistent, and the verification result can be determined as verification failure.
[0138] Step 1003: If the first verification code matches the second verification code, then the verification result is determined to be successful.
[0139] In this context, "verification failed" means that the first data packet was not damaged.
[0140] In this embodiment, the target node can compare the first check code and the second check code. If the comparison result is consistent, it means that the first check code and the second check code are consistent, and the verification result can be determined as successful.
[0141] In this embodiment, the target node can determine the verification result as failed if the first verification code and the second verification code are inconsistent, and determine the verification result as passed if the first verification code and the second verification code are consistent. Since the process of determining the verification result is relatively simple, the verification result can be obtained quickly, thereby quickly determining whether the first data packet has passed the verification.
[0142] Based on any of the above embodiments, Figure 10 Taking the illustrated embodiment as an example, in an exemplary embodiment, the target node is the receiving node, and the above method further includes: if the first verification code and the second verification code are inconsistent, determining the damage type of the first data packet based on the first verification code and the second verification code.
[0143] It should be noted that if the target node is a receiving node, the target node can directly store the first data packet if the first data packet received is undamaged, or, if the first data packet received is damaged, further determine the damage type of the first data packet based on the first check code and the second check code carrying the error indication.
[0144] Optionally, depending on when the first data packet was damaged, the damage type can be determined as damage during data transmission or damage during data reception.
[0145] In some embodiments, such as Figure 11 As shown, the process of "determining the damage type of the first data packet based on the first checksum and the second checksum" includes:
[0146] Step 1101: Determine whether there is a flip relationship between the preset bits in the second check code and the preset bits in the first check code.
[0147] Understandably, in the event of a corrupted data packet, an intermediate node can perform bit flipping on a preset bit in the calculated checksum and then include it in the data packet to add an error marker. When the next node receives the data packet, it can recalculate the checksum and compare it with the original checksum carried in the data packet. This allows it to determine whether the preset bit in the checksum carried in the data packet has been bit flipped.
[0148] In this embodiment, the target node can compare each bit of the second check code with each bit of the first check code one by one to obtain the comparison result, and then determine whether there is a flip relationship between the preset bits in the second check code and the preset bits in the first check code based on the comparison result.
[0149] Step 1102: If the preset bits in the second check code are flipped with the preset bits in the first check code, then the damage type is determined to be damage during data transmission.
[0150] In this embodiment, if the preset bits in the second check code and the preset bits in the first check code have a flip relationship, the target node can determine that the first data packet was damaged when it was transmitted to the previous node, that is, the first data packet was damaged during transmission. Therefore, the damage type can be determined to be damage during data transmission.
[0151] Step 1103: If the preset bits in the second check code do not have a flip relationship with the preset bits in the first check code, then it is determined that the damage type is damaged during data reception.
[0152] In this embodiment, if the preset bits in the second check code and the preset bits in the first check code do not have a flip relationship, the target node can determine that the first data packet was not damaged when it was transmitted to the previous node, that is, the first data packet was not damaged during the transmission process. Therefore, the damage type can be determined to be damage during data reception.
[0153] In this embodiment, when the first checksum and the second checksum are inconsistent, the target node can determine the damage type of the first data packet based on the first checksum and the second checksum, thereby quickly determining the timing of the damage to the first data packet and shortening the fault location time.
[0154] To facilitate understanding by those skilled in the art, the data transmission method provided in this application will be described in detail below, taking the target node as an example. This method may include:
[0155] S1, Receive the first data packet.
[0156] The first data packet includes a first checksum. The first checksum may be a first FCS.
[0157] S2, determine the length of the third byte of the first data packet.
[0158] S3, if the length of the third byte is less than the preset length threshold, delete the first data packet.
[0159] The length threshold can be the minimum Ethernet frame length.
[0160] S4. If the length of the third byte is greater than the length threshold, calculate the second checksum corresponding to the reduced data packet.
[0161] The first check code can be the second FCS.
[0162] S5. If the first check code and the second check code are inconsistent, the check result is determined to be that the check failed.
[0163] S6. If the first check code and the second check code are the same, then the check result is determined to be a successful check.
[0164] S7. If the verification result is that the verification fails, calculate the fourth check code for each target data segment.
[0165] The target data segment is a data segment that belongs to the preset key data segment among multiple data segments.
[0166] S8, for each fourth check code, determine whether the third check code and the fourth check code included in the target data segment are consistent.
[0167] S9. If the third check code and the fourth check code are inconsistent, then delete the target data segment and the data between the target data segment and the first check code from the first data packet to obtain a reduced data packet.
[0168] S10, if the third check code is consistent with the fourth check code, then determine the length of the first byte according to the first data packet, calculate the length difference between the length of the first byte and the length of the second byte of the first check code, and delete bits of length difference bytes forward from the target bit bit in the first data packet to obtain the reduced data packet.
[0169] Wherein, the length of the first byte is the length of the bytes of data stored during transmission, and the target bit is the bit before the start bit of the first checksum.
[0170] S11, if the first check code and the second check code are inconsistent, determine whether there is a flip relationship between the preset bits in the second check code and the preset bits in the first check code.
[0171] S12, if the preset bits in the second check code are flipped with the preset bits in the first check code, then the damage type is determined to be damage during data transmission.
[0172] S13, if the preset bits in the second check code do not have a flip relationship with the preset bits in the first check code, then it is determined that the damage type is damaged during data reception.
[0173] It should be noted that the descriptions in S1-S13 above can be found in the relevant descriptions in the above embodiments, and their effects are similar, so they will not be repeated here.
[0174] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0175] Based on the same inventive concept, this application also provides a data transmission apparatus for implementing the data transmission method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, specific limitations in one or more data transmission apparatus embodiments provided below can be found in the limitations of the data transmission method described above, and will not be repeated here.
[0176] In one embodiment, such as Figure 12 As shown, a data transmission device is provided, comprising: a receiving module 1201, a verification module 1202, and a first determining module 1203, wherein:
[0177] The receiving module 1201 is used to receive a first data packet, the first data packet including a first check code;
[0178] The verification module 1202 is used to verify the first data packet according to the first verification code and obtain the verification result;
[0179] The first determining module 1203 is used to determine the second data packet based on the first data packet when the verification result is that the verification fails, and to send the second data packet to the next node of the target node or store the second data packet.
[0180] In one embodiment, the first determining module 1203 includes:
[0181] A reduction processing unit is used to perform data reduction processing on the first data packet to obtain a reduced data packet;
[0182] The bit-flipping processing unit is used to perform bit-flipping processing on the preset bits in the second check code to obtain the target second check code, which is calculated based on the reduced data packet.
[0183] The replacement unit is used to replace the first checksum in the reduced data packet with the target second checksum to obtain the second data packet.
[0184] In one embodiment, the first data packet further includes multiple data segments, each data segment including a third checksum. The aforementioned reduction processing unit is specifically used for:
[0185] Calculate the fourth check code for each target data segment. The target data segment is the data segment that belongs to the preset key data segment among multiple data segments.
[0186] For each fourth checksum, determine whether the third checksum and the fourth checksum included in the target data segment are consistent;
[0187] If the third check code and the fourth check code are inconsistent, the target data segment and the data between the target data segment and the first check code are deleted from the first data packet to obtain a reduced data packet;
[0188] If the third check code matches the fourth check code, then the first data packet undergoes general data reduction processing to obtain a reduced data packet.
[0189] In one embodiment, the aforementioned reduction processing unit is specifically used for:
[0190] The length of the first byte is determined based on the first data packet, and the length difference between the length of the first byte and the length of the second byte of the first check code is calculated. The length of the first byte is the length of the bytes of data stored during transmission.
[0191] Starting from the target bit in the first data packet, remove bits with a length difference of bytes forward to obtain a reduced data packet. The target bit is the bit before the start bit of the first checksum.
[0192] In one embodiment, the above-mentioned apparatus further includes:
[0193] The second determining module is used to determine the length of the third byte of the first data packet;
[0194] The aforementioned verification module 1202 includes:
[0195] The verification unit is used to verify the first data packet according to the first verification code when the length of the third byte is greater than the preset length threshold, and to obtain the verification result.
[0196] In one embodiment, the above-mentioned apparatus further includes:
[0197] The deletion module is used to delete the first data packet if the length of the third byte is less than the length threshold.
[0198] In one embodiment, the verification module 1202 includes:
[0199] The calculation unit is used to calculate the second checksum corresponding to the first data packet;
[0200] The first determining unit is used to determine that the verification result is that the verification failed if the first verification code and the second verification code are inconsistent.
[0201] The second determining unit is used to determine the verification result as successful if the first verification code and the second verification code are consistent.
[0202] In one embodiment, the target node is a receiving node, and the above-mentioned apparatus further includes:
[0203] The third determining module is used to determine the damage type of the first data packet based on the first and second check codes when the first check code and the second check code are inconsistent.
[0204] In one embodiment, the third determining module described above includes:
[0205] The third determining unit is used to determine whether there is a flip relationship between the preset bits in the second check code and the preset bits in the first check code;
[0206] The fourth determining unit is used to determine the damage type as damage during data transmission if there is a flip relationship between the preset bit in the second check code and the preset bit in the first check code.
[0207] The fifth determining unit is used to determine that the damage type is due to damage during data reception if there is no flipping relationship between the preset bits in the second check code and the preset bits in the first check code.
[0208] Each module in the aforementioned data transmission device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0209] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 13As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores data packets. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a data transmission method.
[0210] Those skilled in the art will understand that Figure 13 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0211] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0212] Receive the first data packet, which includes the first checksum;
[0213] The first data packet is verified based on the first checksum, and the verification result is obtained.
[0214] If the verification result is that the verification fails, the second data packet is determined based on the first data packet, and the second data packet is sent to the next node of the target node or stored.
[0215] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0216] The first data packet is reduced in size to obtain a reduced data packet.
[0217] The preset bits in the second check code are flipped to obtain the target second check code, which is calculated based on the reduced data packet.
[0218] The second data packet is obtained by replacing the first checksum in the reduced data packet with the second checksum of the target data packet.
[0219] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0220] Calculate the fourth check code for each target data segment. The target data segment is the data segment that belongs to the preset key data segment among multiple data segments.
[0221] For each fourth checksum, determine whether the third checksum and the fourth checksum included in the target data segment are consistent;
[0222] If the third check code and the fourth check code are inconsistent, the target data segment and the data between the target data segment and the first check code are deleted from the first data packet to obtain a reduced data packet;
[0223] If the third check code matches the fourth check code, then the first data packet undergoes general data reduction processing to obtain a reduced data packet.
[0224] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0225] The length of the first byte is determined based on the first data packet, and the length difference between the length of the first byte and the length of the second byte of the first check code is calculated. The length of the first byte is the length of the bytes of data stored during transmission.
[0226] Starting from the target bit in the first data packet, remove bits with a length difference of bytes forward to obtain a reduced data packet. The target bit is the bit before the start bit of the first checksum.
[0227] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0228] Determine the length of the third byte of the first data packet;
[0229] The first data packet is verified based on the first checksum to obtain the verification result, including:
[0230] If the length of the third byte is greater than the preset length threshold, the first data packet is verified according to the first check code to obtain the verification result.
[0231] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0232] If the length of the third byte is less than the length threshold, delete the first data packet.
[0233] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0234] Calculate the second checksum corresponding to the first data packet;
[0235] If the first check code and the second check code do not match, the check result is determined to be that the check failed.
[0236] If the first check code matches the second check code, then the verification result is determined to be successful.
[0237] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0238] If the first checksum and the second checksum are inconsistent, the type of damage to the first data packet is determined based on the first checksum and the second checksum.
[0239] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0240] Determine whether there is a flip relationship between the preset bits in the second check code and the preset bits in the first check code;
[0241] If the preset bits in the second check code are flipped relative to the preset bits in the first check code, then the damage type is determined to be damage during data transmission.
[0242] If the preset bits in the second check code do not have a flip relationship with the preset bits in the first check code, then the damage type is determined to be damage during data reception.
[0243] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0244] Receive the first data packet, which includes the first checksum;
[0245] The first data packet is verified based on the first checksum, and the verification result is obtained.
[0246] If the verification result is that the verification fails, the second data packet is determined based on the first data packet, and the second data packet is sent to the next node of the target node or stored.
[0247] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0248] The first data packet is reduced in size to obtain a reduced data packet.
[0249] The preset bits in the second check code are flipped to obtain the target second check code, which is calculated based on the reduced data packet.
[0250] The second data packet is obtained by replacing the first checksum in the reduced data packet with the second checksum of the target data packet.
[0251] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0252] Calculate the fourth check code for each target data segment. The target data segment is the data segment that belongs to the preset key data segment among multiple data segments.
[0253] For each fourth checksum, determine whether the third checksum and the fourth checksum included in the target data segment are consistent;
[0254] If the third check code and the fourth check code are inconsistent, the target data segment and the data between the target data segment and the first check code are deleted from the first data packet to obtain a reduced data packet;
[0255] If the third check code matches the fourth check code, then the first data packet undergoes general data reduction processing to obtain a reduced data packet.
[0256] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0257] The length of the first byte is determined based on the first data packet, and the length difference between the length of the first byte and the length of the second byte of the first check code is calculated. The length of the first byte is the length of the bytes of data stored during transmission.
[0258] Starting from the target bit in the first data packet, remove bits with a length difference of bytes forward to obtain a reduced data packet. The target bit is the bit before the start bit of the first checksum.
[0259] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0260] Determine the length of the third byte of the first data packet;
[0261] The first data packet is verified based on the first checksum to obtain the verification result, including:
[0262] If the length of the third byte is greater than the preset length threshold, the first data packet is verified according to the first check code to obtain the verification result.
[0263] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0264] If the length of the third byte is less than the length threshold, delete the first data packet.
[0265] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0266] Calculate the second checksum corresponding to the first data packet;
[0267] If the first check code and the second check code do not match, the check result is determined to be that the check failed.
[0268] If the first check code matches the second check code, then the verification result is determined to be successful.
[0269] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0270] If the first checksum and the second checksum are inconsistent, the type of damage to the first data packet is determined based on the first checksum and the second checksum.
[0271] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0272] Determine whether there is a flip relationship between the preset bits in the second check code and the preset bits in the first check code;
[0273] If the preset bits in the second check code are flipped relative to the preset bits in the first check code, then the damage type is determined to be damage during data transmission.
[0274] If the preset bits in the second check code do not have a flip relationship with the preset bits in the first check code, then the damage type is determined to be damage during data reception.
[0275] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:
[0276] Receive the first data packet, which includes the first checksum;
[0277] The first data packet is verified based on the first checksum, and the verification result is obtained.
[0278] If the verification result is that the verification fails, the second data packet is determined based on the first data packet, and the second data packet is sent to the next node of the target node or stored.
[0279] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0280] The first data packet is reduced in size to obtain a reduced data packet.
[0281] The preset bits in the second check code are flipped to obtain the target second check code, which is calculated based on the reduced data packet.
[0282] The second data packet is obtained by replacing the first checksum in the reduced data packet with the second checksum of the target data packet.
[0283] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0284] Calculate the fourth check code for each target data segment. The target data segment is the data segment that belongs to the preset key data segment among multiple data segments.
[0285] For each fourth checksum, determine whether the third checksum and the fourth checksum included in the target data segment are consistent;
[0286] If the third check code and the fourth check code are inconsistent, the target data segment and the data between the target data segment and the first check code are deleted from the first data packet to obtain a reduced data packet;
[0287] If the third check code matches the fourth check code, then the first data packet undergoes general data reduction processing to obtain a reduced data packet.
[0288] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0289] The length of the first byte is determined based on the first data packet, and the length difference between the length of the first byte and the length of the second byte of the first check code is calculated. The length of the first byte is the length of the bytes of data stored during transmission.
[0290] Starting from the target bit in the first data packet, remove bits with a length difference of bytes forward to obtain a reduced data packet. The target bit is the bit before the start bit of the first checksum.
[0291] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0292] Determine the length of the third byte of the first data packet;
[0293] The first data packet is verified based on the first checksum to obtain the verification result, including:
[0294] If the length of the third byte is greater than the preset length threshold, the first data packet is verified according to the first check code to obtain the verification result.
[0295] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0296] If the length of the third byte is less than the length threshold, delete the first data packet.
[0297] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0298] Calculate the second checksum corresponding to the first data packet;
[0299] If the first check code and the second check code do not match, the check result is determined to be that the check failed.
[0300] If the first check code matches the second check code, then the verification result is determined to be successful.
[0301] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0302] If the first checksum and the second checksum are inconsistent, the type of damage to the first data packet is determined based on the first checksum and the second checksum.
[0303] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0304] Determine whether there is a flip relationship between the preset bits in the second check code and the preset bits in the first check code;
[0305] If the preset bits in the second check code are flipped relative to the preset bits in the first check code, then the damage type is determined to be damage during data transmission.
[0306] If the preset bits in the second check code do not have a flip relationship with the preset bits in the first check code, then the damage type is determined to be damage during data reception.
[0307] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0308] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0309] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0310] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A data transmission method, characterized in that, For the target node, the method includes: Receive a first data packet, wherein the first data packet includes a first checksum; The first data packet is verified based on the first verification code to obtain the verification result; If the verification result is that the verification fails, a second data packet is determined based on the first data packet, and the second data packet is sent to the next node of the target node or stored.
2. The method according to claim 1, characterized in that, Determining the second data packet based on the first data packet includes: The first data packet is reduced in size to obtain a reduced data packet; The preset bits in the second check code are flipped to obtain the target second check code, which is calculated based on the reduced data packet. The second data packet is obtained by replacing the first checksum in the reduced data packet with the target second checksum.
3. The method according to claim 2, characterized in that, The first data packet further includes multiple data segments, each of which includes a third checksum. The step of reducing the data packet size to obtain a reduced data packet includes: Calculate the fourth checksum for each target data segment, wherein the target data segment is the data segment that belongs to the preset key data segment among the plurality of data segments; For each of the fourth check codes, determine whether the third check code included in the target data segment is consistent with the fourth check code; If the third check code is inconsistent with the fourth check code, then the target data segment and the data between the target data segment and the first check code are deleted from the first data packet to obtain the reduced data packet; If the third check code matches the fourth check code, then the first data packet is subjected to general data reduction processing to obtain the reduced data packet.
4. The method according to claim 3, characterized in that, The step of performing general data reduction processing on the first data packet to obtain the reduced data packet includes: The length of the first byte is determined based on the first data packet, and the length difference between the length of the first byte and the length of the second byte of the first check code is calculated. The length of the first byte is the length of the bytes of data stored during transmission. The reduced data packet is obtained by deleting bits of the specified length difference bytes forward from the target bit in the first data packet, where the target bit is the bit preceding the start bit of the first checksum.
5. The method according to claim 1, characterized in that, The method further includes: Determine the length of the third byte of the first data packet; The step of verifying the first data packet based on the first checksum to obtain a verification result includes: If the length of the third byte is greater than a preset length threshold, the first data packet is verified according to the first checksum to obtain a verification result.
6. The method according to claim 5, characterized in that, The method further includes: If the length of the third byte is less than the length threshold, the first data packet is deleted.
7. The method according to claim 1, characterized in that, The step of verifying the first data packet based on the first checksum to obtain a verification result includes: Calculate the second checksum corresponding to the first data packet; If the first verification code and the second verification code are inconsistent, the verification result is determined to be a verification failure. If the first verification code matches the second verification code, then the verification result is determined to be successful.
8. The method according to claim 7, characterized in that, The target node is a receiving node, and the method further includes: If the first checksum and the second checksum are inconsistent, the damage type of the first data packet is determined based on the first checksum and the second checksum.
9. The method according to claim 8, characterized in that, Determining the damage type of the first data packet based on the first checksum and the second checksum includes: Determine whether there is a flip relationship between the preset bits in the second check code and the preset bits in the first check code; If the preset bits in the second check code are flipped relative to the preset bits in the first check code, then the damage type is determined to be damage during data transmission. If the preset bits in the second check code do not have a flip relationship with the preset bits in the first check code, then it is determined that the damage type was damaged during data reception.
10. A data transmission device, characterized in that, For a target node, the device includes: A receiving module is used to receive a first data packet, wherein the first data packet includes a first checksum; The verification module is used to verify the first data packet according to the first verification code and obtain the verification result; The first determining module is configured to, in the case that the verification result is that the verification fails, determine the second data packet based on the first data packet, and send the second data packet to the next node of the target node or store the second data packet.
11. A computer device, characterized in that, Includes memory, transceiver, and processor: The memory is used to store a computer program; the transceiver is used to send and receive data under the control of the processor; the processor is used to read the computer program in the memory and execute the steps of the method according to any one of claims 1 to 9.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 9.
13. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 9.