Data transmission method and device, equipment and storage medium
By checking and combining UDP packets on the receiving end and adjusting the packet size at the sending end according to the network conditions, the problem of UDP packet loss in the wireless network distribution network is solved, and efficient and reliable data transmission is achieved.
Patent Information
- Application Number
- CN202411632508.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-03-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
During the wireless network distribution process, data packets are easily lost in the UDP environment. Existing solutions such as the TCP protocol increase network overhead and latency, and are not suitable for scenarios with high requirements for real-time performance.
Provide a data transmission method, by checking the verification data packet to be checked by the receiving end, combining the verification data, and comparing it with the target data, to determine whether the data transmission is successful or failed. At the same time, the sending end adjusts the packet size according to the network condition and resends the data packet to be verified when receiving the retransmission signal.
It effectively reduces UDP data loss, improves the reliability and efficiency of data transmission, is suitable for various wireless network environments, meets the real-time requirements of wireless network distribution networks, and reduces network overhead and latency.
Smart Images

Figure CN119628789A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data transmission, and in particular to a data transmission method and device, an electronic device and a storage medium. Background Art
[0002] During wireless network configuration, UDP (User Datagram Protocol) often causes packet loss when the data volume is large due to its connectionless and non-confirmation characteristics. Existing solutions mostly use TCP (Transmission Control Protocol), but TCP increases network overhead and latency due to its connectivity and confirmation mechanism, and is not suitable for scenarios with high real-time requirements. Summary of the invention
[0003] The embodiment of the present application provides a data transmission method to solve the problem that data packets are easily lost in a UDP environment.
[0004] Correspondingly, an embodiment of the present application also provides a data transmission device, an electronic device and a storage medium to ensure the implementation and application of the above method.
[0005] In order to solve the above problem, an embodiment of the present application discloses a data transmission method, which is applied to a receiving end, and the receiving end is communicatively connected with a sending end. The method includes:
[0006] Receiving target data sent by the sending end;
[0007] Verifying a plurality of to-be-verified data packets in the target data, and determining a to-be-verified data packet that passes the verification as a first data packet;
[0008] combining a plurality of the first data packets into verification data;
[0009] Comparing the verification data with the target data to determine whether the verification data and the target data are consistent;
[0010] If the verification data is consistent with the target data, it is determined that the target data transmission is successful; or if the verification data is inconsistent with the target data, it is determined that the target data transmission fails.
[0011] Optionally, verifying a plurality of to-be-verified data packets in the target data and determining a to-be-verified data packet that passes the verification as a first data packet includes:
[0012] Adding the pseudo header, header and data message in the data packet to be checked in sequence to obtain first data corresponding to the data packet to be checked;
[0013] Invert the first data corresponding to the data packet to be verified to obtain the second data corresponding to the data packet to be verified;
[0014] If the second data corresponding to the data packet to be verified is the same as the verification code corresponding to the data packet to be verified, the data packet to be verified is determined to be the first data packet.
[0015] Optionally, after verifying the multiple data packets to be verified in the target data and determining the data packet to be verified that passes the verification as the first data packet, the method further includes:
[0016] Determine the to-be-verified data packet that fails the verification as the second data packet;
[0017] Sending a retransmission signal for the second data packet to the transmitting end, so that the transmitting end resends the second data packet based on the retransmission signal of the second data packet;
[0018] receiving the second data packet sent by the sending end;
[0019] The second data packet is verified, and a second data packet that passes the verification is determined as the first data packet.
[0020] Optionally, combining the plurality of first data packets into verification data includes:
[0021] When the number of the first data packets is the same as the number of the data packets to be verified, a plurality of the first data packets are combined into the verification data according to the packet sequence numbers corresponding to the first data packets.
[0022] Optionally, the method further includes:
[0023] When the number of the first data packets and the number of the data packets to be checked within the preset time are different, the missing data packets to be checked are determined as the third data packets according to the packet sequence numbers corresponding to the first data packets;
[0024] Sending a retransmission signal for the third data packet to the transmitting end, so that the transmitting end retransmits the third data packet based on the retransmission signal of the third data packet;
[0025] Receiving the third data packet sent by the sending end;
[0026] The third data packet is verified, and the third data packet that passes the verification is determined as the first data packet.
[0027] The embodiment of the present application also discloses a data transmission method, which is applied to a sending end, wherein the sending end is connected to a receiving end for communication, and the method includes:
[0028] Adjusting the size of the data packet according to the network status; the network status is used to characterize the network environment during data transmission;
[0029] Dividing the target data into a plurality of data packets to be verified according to the size of the data packets, and sending the plurality of data packets to be verified to the receiving end, so that the receiving end verifies the plurality of data packets to be verified and combines the data packets to be verified that pass the verification; the size of the data packets to be verified is the same as the size of the data packets;
[0030] When a retransmission signal sent by the receiving end is received, the to-be-verified data packet corresponding to the retransmission signal is resent to the receiving end, so that the receiving end verifies the to-be-verified data packet corresponding to the retransmission signal.
[0031] Optionally, the network status is determined according to network parameters, the network parameters include delay, packet loss rate, bandwidth and jitter, and adjusting the data packet size according to the network status includes:
[0032] Multiplying the network parameter and the weight corresponding to the network parameter to obtain weight scores corresponding to the plurality of network parameters;
[0033] Adding weight scores corresponding to the plurality of network parameters to obtain a target weight score;
[0034] When the target weight score exceeds a weight threshold, increasing the data packet size;
[0035] When the target weight score does not exceed the weight threshold, the data packet size is reduced.
[0036] Optionally, dividing the target data into a plurality of data packets to be verified according to the size of the data packet includes:
[0037] Determine the number of data packets according to the length of the target data and the size of the data packet;
[0038] The target data is divided into a plurality of data packets to be verified based on the number of the data packets; the number of the data packets to be verified is the same as the number of the data packets.
[0039] Optionally, the method further includes:
[0040] Determine the preset time according to the network status;
[0041] The preset time is sent to the receiving end so that the receiving end determines whether the to-be-checked data packet received within the preset time is complete.
[0042] The embodiment of the present application further discloses a data transmission device, which is applied to a receiving end, and the receiving end is communicatively connected with a sending end, and the device includes:
[0043] A receiving module, used for receiving target data sent by the sending end;
[0044] A verification module, used for verifying a plurality of to-be-verified data packets in the target data, and determining a to-be-verified data packet that passes the verification as a first data packet;
[0045] A combining module, used for combining a plurality of the first data packets into verification data;
[0046] A comparison module, used to compare the verification data with the target data to determine whether the verification data and the target data are consistent;
[0047] The judgment module is used to judge that the target data transmission is successful if the verification data is consistent with the target data; or judge that the target data transmission is failed if the verification data is inconsistent with the target data.
[0048] The embodiment of the present application also discloses a data transmission device, which is applied to a sending end, and the sending end is communicatively connected with a receiving end, and the device includes:
[0049] An adjustment module, used for adjusting the size of a data packet according to a network condition; the network condition is used for characterizing a network environment during data transmission;
[0050] a division module, used for dividing the target data into a plurality of data packets to be verified according to the size of the data packet, and sending the plurality of data packets to be verified to the receiving end, so that the receiving end verifies the plurality of data packets to be verified and combines the data packets to be verified that pass the verification; the size of the data packets to be verified is the same as the size of the data packet;
[0051] The retransmission module is used to resend the to-be-verified data packet corresponding to the retransmission signal to the receiving end when receiving the retransmission signal sent by the receiving end, so that the receiving end can verify the to-be-verified data packet corresponding to the retransmission signal.
[0052] An embodiment of the present application further discloses an electronic device, including: a processor; and a memory, on which executable code is stored. When the executable code is executed, the processor executes the data transmission method as described in any one of the embodiments of the present application.
[0053] The embodiments of the present application also disclose one or more machine-readable media on which executable codes are stored. When the executable codes are executed, a processor executes the data transmission method as described in any one of the embodiments of the present application.
[0054] Compared with the prior art, the embodiments of the present application have the following advantages:
[0055] In an embodiment of the present application, the receiving end receives the target data sent by the sending end; verifies multiple data packets to be verified in the target data, and determines the data packets to be verified that pass the verification as the first data packet; combines multiple first data packets into verification data; compares the verification data with the target data to determine whether the verification data and the target data are consistent; if the verification data and the target data are consistent, it is determined that the target data transmission is successful; or, if the verification data and the target data are inconsistent, it is determined that the target data transmission fails. The receiving end in the embodiment of the present application can ensure that the received data is consistent with the sent data by verifying the received multiple data packets to be verified, reducing data loss or damage caused by network problems or equipment failures during data transmission, thereby improving the reliability of data transmission; and, by comparing the verification data and the target data, errors in the data transmission process can be discovered in time, avoiding further processing or storage of erroneous data, improving the accuracy of data transmission, and reducing subsequent processing problems caused by data errors; in addition, through packet verification and combination, the verification of multiple data packets to be verified can be processed in parallel, reducing the time for verification of a single data packet, speeding up the speed of overall data transmission, and thus improving the efficiency of data transmission.
[0056] In an embodiment of the present application, the sending end adjusts the data packet size according to the network conditions; the network conditions are used to characterize the network environment during data transmission; the target data is divided into multiple data packets to be verified according to the data packet size, and the multiple data packets to be verified are sent to the receiving end, so that the receiving end verifies the multiple data packets to be verified and combines the data packets to be verified that have passed the verification; the size of the data packet to be verified is the same as the data packet size; when a retransmission signal sent by the receiving end is received, the data packet to be verified corresponding to the retransmission signal is resent to the receiving end, so that the receiving end verifies the data packet to be verified corresponding to the retransmission signal. The sending end in the embodiment of the present application can adapt to different network environments, such as high latency, high packet loss rate, low bandwidth, etc., by dynamically adjusting the data packet size, which can improve the flexibility and adaptability of data transmission and ensure that data can be effectively transmitted under various network conditions; and, by reasonably dividing the data packet size, it is possible to fully utilize the network bandwidth, reduce the data transmission time, improve the efficiency of data transmission, and reduce the transmission delay of data packets in the network; in addition, through the retransmission mechanism, the fault tolerance capability of data transmission is enhanced to ensure that data transmission can still be completed in the event of network instability or data packet loss, thereby avoiding the failure of the entire data transmission process due to a single data packet error. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 is a flowchart of a data transmission method embodiment of the present application;
[0058] Figure 2 It is a flowchart of a data reorganization of the present application;
[0059] Figure 3 is a flowchart of another data transmission method embodiment of the present application;
[0060] Figure 4 It is a schematic diagram of a process of dynamically adjusting the size of a data packet of the present application;
[0061] Figure 5 is a structural block diagram of an embodiment of a data transmission device of the present application;
[0062] Figure 6 is a structural block diagram of another data transmission device embodiment of the present application;
[0063] Figure 7 It is a schematic diagram of the structure of a device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0064] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0065] During the wireless network configuration process, packet loss often occurs in the UDP environment when the data volume is large. However, during the data transmission process, packet loss will affect the reliability and efficiency of data transmission, and the reliability of data transmission will directly affect the success rate of network configuration, and the efficiency of data transmission will directly affect the time of the network configuration process. Therefore, if a large number of data packets are lost during the data transmission process, the efficiency of the network configuration process will be reduced, and may even cause network configuration failure.
[0066] Most existing solutions use the TCP protocol. However, wireless network configuration usually has high requirements for real-time performance. The traditional TCP protocol increases network overhead and latency due to its connectivity and confirmation mechanism, and is not suitable for such scenarios with high real-time requirements.
[0067] Therefore, in order to solve the problem that UDP data is easily lost during wireless network configuration and improve the success rate and efficiency of configuration, an embodiment of the present application provides a data transmission method that reduces data loss in a UDP environment. By adopting packet subdivision technology and a reliable transmission mechanism, it can not only effectively reduce the loss of UDP data and improve the reliability and efficiency of data transmission, and is suitable for various wireless network environments, but also can meet the real-time requirements of wireless network configuration, reduce network overhead and delay, thereby improving the success rate and efficiency of configuration.
[0068] During the wireless network configuration process, the receiving end and the sending end establish a communication connection through the wireless network for data transmission and processing. The sending end is responsible for sending data, and the receiving end is responsible for receiving data.
[0069] Specifically, the receiving end is responsible for receiving, checking, combining, comparing and judging the results of data transmission, and sending feedback signals to the sending end. The sending end is responsible for sending data, data packetization, data transmission, retransmission mechanism and dynamic adjustment of data packet size. Through the collaborative work between the receiving end and the sending end, the reliability, accuracy and integrity of data transmission can be ensured, thereby improving the success rate and efficiency of the distribution network.
[0070] Reference Figure 1 , is a flowchart of a data transmission method embodiment of the present application, applied to a receiving end, the receiving end is connected to a sending end for communication, and includes the following steps:
[0071] Step 101, receiving target data sent by the sending end;
[0072] In the embodiment of the present application, the target data refers to the original data sent by the sending end to the receiving end.
[0073] Step 102: verify multiple data packets to be verified in the target data, and determine the data packet to be verified that passes the verification as the first data packet;
[0074] In the embodiment of the present application, since the transmitting end will first split the target data into multiple data packets to be verified and then send them to the receiving end, the receiving end will receive multiple data packets to be verified. However, during the data transmission process, when the transmitting end sends the target data to the receiving end, the target data may be lost or erroneous. Therefore, the target data received by the receiving end may not be the same as the target data sent by the transmitting end. At this time, it can be simply understood that the target data is the data before transmission, and the multiple data packets to be verified are the data after transmission.
[0075] After receiving multiple data packets to be verified, the receiving end will verify the multiple data packets to be verified respectively, in order to check the integrity and correctness of the transmitted data packets.
[0076] If the verification is passed, the data packet to be verified that has passed the verification will be stored in the cache area; if the verification is not passed, the data packet to be verified that has not passed the verification will be discarded.
[0077] In the embodiment of the present application, the data packet to be verified that passes the verification is determined as the first data packet, and the data packet to be verified that fails the verification is determined as the second data packet. Subsequently, the first data packet is stored in the buffer area, and the second data packet is discarded.
[0078] The embodiment of the present application can ensure that the received data packets are complete and correct by verifying multiple data packets to be verified, reduce errors and losses during data transmission, improve the reliability of data transmission, and ensure that the data processed subsequently is credible.
[0079] In one embodiment of the present application, in addition to verifying the integrity and correctness of the data packets to be verified, each data packet to be verified can also be sorted. Each data packet to be verified can include a unique identifier (packet sequence number) so that the receiving end can correctly reassemble the data packet according to the packet sequence number to avoid reassembly failure caused by wrong data packet sequence.
[0080] In an embodiment of the present application, the receiving end will perform verification after receiving the data packet to be verified. A retransmission request will be initiated for the data packet that fails the verification, and packets are transmitted independently from each other, without the need to wait for the previous packet to pass the verification before transmitting the next packet.
[0081] Step 103: combine multiple first data packets into verification data;
[0082] In the embodiment of the present application, since the data packets to be verified that fail the verification will be discarded, when performing data reorganization, the data packets to be verified that fail the verification (the second data packets) are not considered, and only the data packets to be verified that pass the verification (the first data packets) are considered.
[0083] Therefore, the embodiment of the present application recombines multiple first data packets to form a complete verification data to facilitate subsequent determination of whether it is the same as the original data (target data), thereby avoiding separate comparison between each data packet before and after transmission, and improving data processing efficiency.
[0084] Step 104: Compare the verification data with the target data to determine whether the verification data and the target data are consistent;
[0085] In the embodiment of the present application, after data reorganization, further verification of the check data is required to verify the integrity of the data packet and determine whether the data packet received by the receiving end is missing. Specifically, the total number of packets in the check data and the total number of packets in the target data are confirmed to be consistent to ensure the integrity of the data received by the receiving end.
[0086] Step 105: If the verification data is consistent with the target data, it is determined that the target data transmission is successful; or, if the verification data is inconsistent with the target data, it is determined that the target data transmission fails.
[0087] In the embodiment of the present application, whether the target data transmission is successful is determined based on the comparison result between the verification data and the target data. Specifically, if they are consistent, it means that the data transmission is successful; if they are inconsistent, it means that the data transmission fails.
[0088] When data transmission fails, the receiving end will directly discard the verification data, and then send a retransmission request for the target data to the sending end, requiring the sending end to resend the target data and re-execute the above steps 101 to 105 until the data transmission is successful.
[0089] The embodiments of the present application can ensure the reliability and accuracy of data transmission by determining whether data transmission is successful or not, and can promptly detect data transmission failures, and can take retransmission or other remedial measures to improve the fault tolerance of data transmission.
[0090] The receiving end in the embodiment of the present application can ensure that the received data is consistent with the sent data by verifying the received multiple data packets to be verified, thereby reducing data loss or damage due to network problems or equipment failures during data transmission, thereby improving the reliability of data transmission; and, by comparing the verification data and the target data, it is possible to promptly discover errors in the data transmission process and avoid further processing or storage of erroneous data, thereby improving the accuracy of data transmission and reducing subsequent processing problems caused by data errors; in addition, through packet verification and combination, the verification of multiple data packets to be verified can be processed in parallel, reducing the time for verifying a single data packet, speeding up the overall data transmission speed, and thereby improving the efficiency of data transmission.
[0091] In one embodiment of the present application, the step 102 of verifying a plurality of data packets to be verified in the target data and determining the data packet to be verified that passes the verification as the first data packet includes:
[0092] Adding the pseudo header, header and data message in the data packet to be checked in sequence to obtain first data corresponding to the data packet to be checked;
[0093] Invert the first data corresponding to the data packet to be verified to obtain the second data corresponding to the data packet to be verified;
[0094] If the second data corresponding to the data packet to be verified is the same as the verification code corresponding to the data packet to be verified, the data packet to be verified is determined to be the first data packet.
[0095] During the transmission of UDP datagrams, the bits of the datagrams (i.e., the actual transmitted user data) may change due to network noise, signal interference, router failure, etc. These changes may cause the content of the received datagram to be tampered with or damaged.
[0096] In the embodiment of the present application, the UDP checksum verification method is used to verify multiple data packets to be verified. The UDP checksum is used for UDP error detection to confirm whether a bit change occurs during the data transmission from the sender to the receiver. A bit refers to the smallest unit of data, that is, a binary bit (0 or 1).
[0097] In the actual data transmission process, the sender will first construct a pseudo header and a header, and then generate a check code based on the data message of each data packet to be checked. The sender will store the pseudo header, header, and check code in the data packet to be checked, and then transmit it to the receiving end. Therefore, the data packet to be checked received by the receiving end includes the pseudo header, header, data message, and check code.
[0098] The pseudo header includes: source IP address (4 bytes), destination IP address (4 bytes), protocol type (1 byte) and UDP length (2 bytes).
[0099] The header contains: source port number (2 bytes), destination port number (2 bytes), UDP length (2 bytes), and checksum (2 bytes, set to 0 during calculation).
[0100] The datagram is the actual user data transmitted, following the header.
[0101] Specifically, the receiving end extracts the pseudo header, header, data message and check code from the received data packet to be checked. When checking each data packet to be checked, the pseudo header, header and data message are first added up to obtain a 32-bit number (first data); the accumulated first data is then inverted to obtain the second data, and the inversion operation is to invert each bit of the 32-bit number (0 becomes 1, 1 becomes 0); finally, the second data (checksum) obtained after inversion is compared with the check code in the data packet to be checked. If the two are the same, it means that the data packet to be checked has passed the verification, and the data packet to be checked can be determined as the first data packet.
[0102] Assume that the pseudo header, header, and data message of a received data packet to be verified are as follows:
[0103] Pseudo header: source IP address is 192.168.1.1 (C0 A8 01 01), destination IP address is 192.168.1.2 (C0A8 01 02), protocol type is 17 (0x11), UDP length is 100 bytes (00 64);
[0104] Header: Source port number is 12345 (30 39), destination port number is 54321 (D4 31), UDP length is 100 bytes (00 64), checksum is 00 00 (set to 0 during calculation);
[0105] Data message: Assuming it is 100 bytes of data, after conversion to hexadecimal, it is 01 02 03 0405 06 0708... (100 bytes in total).
[0106] Then, convert all the data in the pseudo header, header, and data message into hexadecimal numbers:
[0107] Pseudo header: C0 A8 01 01C0 A8 01 02 00 11 00 64
[0108] Head: 30 39D4 31 00 64 00 00
[0109] Data message: 01 02 03 04 05 06 07 08...
[0110] Then add all the hexadecimal numbers in sequence and handle the carry:
[0111] C0 A8+01 01=C1 A9, C1 A9+C0 A8=182 51, 182 51+01 02=183 53, 183 53+0011=183 64, 183 64+00 64=183C8, 183C8+30 39=1B4 01, 1B4 01+D4 31=288 32, 28832+00 64=288 96, 288 96+00 00=288 96, 288 96+01 02=289 98, 289 98+03 04=28C9C, 28C 9C+05 06=291A2, 291A2+07 08=298AA...
[0112] Finally, negate it to get the checksum:
[0113] Invert the final hexadecimal number obtained by accumulation to obtain the checksum. Assuming that the final hexadecimal number obtained by accumulation is 298AA, invert it to obtain the checksum D6 75 5.
[0114] If the check code is also D6 75 5, it is considered that the data packet to be checked has passed the check and can be used as the first data packet. If the check code is not D6 75 5, it is considered that the data packet to be checked has failed the check and can be used as the second data packet.
[0115] The embodiment of the present application ensures that the received data packet to be verified is complete and correct by verifying the integrity and correctness of the data packet to be verified. This not only enables timely discovery of errors in the data transmission process and avoids further processing or storage of erroneous data, but also ensures that the received data is consistent with the sent data, thereby improving the accuracy of data transmission.
[0116] In one embodiment of the present application, after verifying the multiple data packets to be verified in the target data in step 102 and determining the verified data packet to be verified as the first data packet, the method further includes:
[0117] Determine the to-be-verified data packet that fails the verification as the second data packet;
[0118] Sending a retransmission signal for the second data packet to the transmitting end, so that the transmitting end resends the second data packet based on the retransmission signal of the second data packet;
[0119] receiving the second data packet sent by the sending end;
[0120] The second data packet is verified, and a second data packet that passes the verification is determined as the first data packet.
[0121] During the data transmission process, due to network noise interference, software and hardware failures, network congestion and other reasons, data packets may be tampered with or lost, resulting in verification failure.
[0122] Specifically, when the second data corresponding to the data packet to be verified is different from the verification code corresponding to the data packet to be verified, it is considered that the data packet to be verified fails the verification. At this time, the data packet to be verified is determined to be the second data packet and is discarded.
[0123] Before discarding the second data packet, the receiving end determines the packet sequence number in the second data packet, generates a retransmission signal for the second data packet based on the packet sequence number, and sends it to the sending end, so that the sending end can resend the second data packet.
[0124] However, the second transmission of the data packet by the sending end also requires the network to be transmitted, which may also cause the second transmitted data message to be tampered with or lost. Therefore, when the receiving end receives the second data packet sent for the second time, it also needs to verify it. If the verification is successful, it will be used as the first data packet for subsequent data reorganization. If the verification is unsuccessful, the above retransmission process will continue until the verification is successful. In the embodiment of the present application, the "first data packet" specifically refers to the data packet to be verified that has passed the verification, whether it is the data packet to be verified that has passed the initial verification or the data packet to be verified that has passed the verification after retransmission, all belong to the "first data packet", and the "second data packet" specifically refers to the data packet to be verified that has not passed the verification, whether it is the data packet to be verified that has not passed the initial verification or the data packet to be verified that has not passed the verification after retransmission, all belong to the "second data packet".
[0125] The embodiments of the present application correct errors in the data transmission process in a timely manner through verification, reduce subsequent processing problems caused by data errors, improve the accuracy of data transmission, and prevent erroneous data from being further processed or stored. In addition, through the retransmission mechanism, the fault tolerance of data transmission is enhanced to ensure that data transmission can still be completed in the case of network instability or data packet loss.
[0126] In one embodiment of the present application, the step 103 of combining the plurality of the first data packets into verification data includes:
[0127] When the number of the first data packets is the same as the number of the data packets to be verified, a plurality of the first data packets are combined into the verification data according to the packet sequence numbers corresponding to the first data packets.
[0128] In an embodiment of the present application, the receiving end will first determine whether the number of received first data packets is the same as the total number of data packets to be verified. If the number of first data packets is the same as the total number of data packets to be verified, the receiving end will combine multiple first data packets into a complete verification data according to the packet sequence number corresponding to each first data packet (i.e., the sequential number of the data packets).
[0129] In one embodiment of the present application, in addition to the case where the number of first data packets is the same as the number of data packets to be verified, it is possible to further determine whether there are data packets that are duplicated or missing based on the packet sequence numbers corresponding to the first data packets. Therefore, in an embodiment of the present application, when the number of first data packets is the same as the number of data packets to be verified and there are no duplicate packet sequence numbers corresponding to the first data packets, multiple first data packets can be combined into a complete verification data according to the packet sequence numbers corresponding to each first data packet.
[0130] The embodiment of the present application ensures that the received data packets are complete and there are no lost or duplicated data packets by judging whether the number of the first data packets is the same as the total number of data packets to be verified, thereby avoiding incomplete verification data due to lost or duplicated data packets; by combining data packets according to packet sequence numbers, it can ensure that the data packets are reassembled in the correct order, avoiding reassembly failures due to incorrect data packet sequence, improving the accuracy of data reassembly, and ensuring the correctness of verification data.
[0131] Reference Figure 2 , is a flow chart of a data reorganization process of the present application, which specifically includes: the receiving end receives the data packets to be checked from the sending end, and stores these data packets in a buffer area according to the sequence number; performs an integrity check on the received data packets to ensure that the data packets have not been tampered with or damaged during transmission; checks the sequence numbers of the data packets to ensure that the sequence of the data packets is correct; according to the sequence numbers of the data packets, the data packets are reassembled in the correct order to form complete data; after the data reorganization is completed, the receiving end sends a reorganization completion signal to notify the sending end that the data reorganization is completed and the next step can be performed.
[0132] In one embodiment of the present application, the method further includes:
[0133] When the number of the first data packets and the number of the data packets to be checked within the preset time are different, the missing data packets to be checked are determined as the third data packets according to the packet sequence numbers corresponding to the first data packets;
[0134] Sending a retransmission signal for the third data packet to the transmitting end, so that the transmitting end retransmits the third data packet based on the retransmission signal of the third data packet;
[0135] Receiving the third data packet sent by the sending end;
[0136] The third data packet is verified, and the third data packet that passes the verification is determined as the first data packet.
[0137] In an embodiment of the present application, within a preset time, the receiving end will determine whether the number of received first data packets is the same as the total number of data packets to be verified. If the number of first data packets is different from the total number of data packets to be verified, the receiving end will determine the missing data packets to be verified based on the packet sequence numbers corresponding to the first data packets, and determine these missing data packets as third data packets; the receiving end sends a retransmission signal for the third data packet to the sending end, requiring the sending end to resend these missing data packets; the receiving end receives the third data packet sent by the sending end, verifies the third data packet, and determines the third data packet that passes the verification as the first data packet.
[0138] Specifically, during the data transmission process, the sending end will split the target data into multiple data packets to be verified and assign a unique packet number to each data packet. After receiving these data packets, the receiving end will verify each data packet and determine the data packet that has passed the verification as the first data packet. Within a preset time, the receiving end determines whether the number of received first data packets is the same as the total number of data packets to be verified. If the number is the same, it means that all data packets have been successfully received and verified; if the number is different, it means that data packets are lost or duplicated and need further processing.
[0139] The preset time in the embodiment of the present application refers to the maximum time limit when the receiving end waits for a data packet. The preset time is set to avoid infinite waiting for data, especially when the network is unstable or there is packet loss. Specifically, the receiving end starts timing after receiving the first data packet and waits to receive all data packets within the preset time. If all data packets are not received within the preset time, the receiving end will consider that some data packets are lost and trigger a retransmission mechanism.
[0140] In an embodiment of the present application, the setting of the preset time can be dynamically adjusted according to the specific network environment and application scenario, and the following factors can be referred to:
[0141] 1) Network delay:
[0142] Network latency refers to the time it takes for a data packet to travel from the sender to the receiver. The preset time should be greater than the network latency to ensure that all data packets are received within a reasonable time.
[0143] 2) Packet loss rate:
[0144] Packet loss rate refers to the proportion of data packets lost during transmission. The preset time should take the packet loss rate into account to ensure that most data packets are received within a reasonable time.
[0145] 3) Packet size:
[0146] The size of the data packet affects the transfer time. Larger data packets take longer to transfer and the preset time should be adjusted accordingly.
[0147] 4) Network bandwidth:
[0148] Network bandwidth refers to the maximum rate at which a network can transmit data. The preset time should take network bandwidth into account to ensure that all packets are received within a reasonable time.
[0149] The embodiments of the present application enhance the fault tolerance of data transmission through a retransmission mechanism, ensuring that data transmission can still be completed in the event of network instability or data packet loss, avoiding the failure of the entire data transmission process due to a single data packet error, and avoiding infinite waiting for data through a preset time limit, thereby improving the efficiency of data transmission.
[0150] The receiving end in the embodiment of the present application can ensure that the received data is consistent with the sent data by verifying the received multiple data packets to be verified, thereby reducing data loss or damage due to network problems or equipment failures during data transmission, thereby improving the reliability of data transmission; and, by comparing the verification data and the target data, it is possible to promptly discover errors in the data transmission process and avoid further processing or storage of erroneous data, thereby improving the accuracy of data transmission and reducing subsequent processing problems caused by data errors; in addition, through packet verification and combination, the verification of multiple data packets to be verified can be processed in parallel, reducing the time for verifying a single data packet, speeding up the overall data transmission speed, and thereby improving the efficiency of data transmission.
[0151] Reference Figure 3 , shows a flowchart of another data transmission method embodiment of the present application, which is applied to a sending end, and the sending end is connected to a receiving end for communication, and includes the following steps:
[0152] Step 301, adjusting the data packet size according to the network status; the network status is used to characterize the network environment during data transmission;
[0153] In the embodiment of the present application, the sender dynamically adjusts the size of the data packet according to the current network status before sending the data. Specifically, the sender monitors the current network status and then dynamically adjusts the size of the data packet according to the monitored network status to adapt to different network environments during data transmission.
[0154] In network transmission, the determination of network status is usually based on the following key indicators:
[0155] 1) Latency: This is the time it takes for a data packet to travel from the sender to the receiver. Latency is usually determined by measuring the round-trip time (RTT) of a data packet.
[0156] 2) Packet Loss Rate: This is the proportion of packets lost during transmission. A high packet loss rate indicates that the network is unstable and the packet size may need to be adjusted to accommodate this situation.
[0157] 3) Bandwidth: This is the maximum rate at which the network can transmit data. The size of the bandwidth determines the amount of data that can be transmitted.
[0158] 4) Jitter: This is the variation in packet delay. High jitter can cause inconsistent packet arrival times, affecting transmission quality.
[0159] In the embodiments of the present application, the specific methods for monitoring network status are as follows:
[0160] 1) Latency measurement
[0161] ① Ping test: Send an ICMP echo request (Echo Request) to the target host and measure the time it takes for the echo reply (Echo Reply) to return. Through multiple Ping tests, the average delay time can be obtained.
[0162] ping -c 10example.com
[0163] ②RTT measurement: Send a data packet at the application layer and wait for confirmation from the receiving end, measuring the time of the entire round-trip process.
[0164] import timeimport socket
[0165] def measure_rtt(target):
[0166] sock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
[0167] start_time = time.time()
[0168] sock.sendto(b'test',(target,12345))
[0169] sock.recvfrom(1024)
[0170] end_time = time.time()
[0171] rtt = end_time - start_time
[0172] return rtt
[0173] rtt=measure_rtt('example.com')print(f"RTT:{rtt}seconds")
[0174] 2) Packet loss rate measurement
[0175] ① Counting packet loss: Calculate the packet loss rate by sending a certain number of data packets and counting the number of data packets not received by the receiving end.
[0176] ping -c 100example.com
[0177] The packet loss rate is displayed in the output.
[0178] ②Application layer statistics: A group of data packets are sent at the application layer. The receiving end counts the number of received data packets and feeds them back to the sending end to calculate the packet loss rate.
[0179] total_packets = 100
[0180] lost_packets=total_packets-received_packets
[0181] loss_rate=lost_packets / total_packets
[0182] 3) Bandwidth measurement
[0183] ①iPerf tool: The iPerf tool can be used to measure network bandwidth.
[0184] On the server side - iperf -s
[0185] On the client side - iperf -c server_ip
[0186] ② Application layer measurement: Send fixed-size data packets, measure the transmission time, and thus calculate the bandwidth.
[0187] import time
[0188] data_size = 10*1024*1024 # 10MB
[0189] start_time = time.time()
[0190] sock.sendall(b'a'*data_size)
[0191] end_time = time.time()
[0192] bandwidth=data_size / (end_time-start_time)
[0193] 4) Jitter measurement
[0194] Delay variation: By measuring the delay multiple times, the standard deviation of the delay is calculated as the jitter value.
[0195] import statistics
[0196] delays=[measure_rtt('example.com')for_in range(100)]
[0197] jitter=statistics.stdev(delays)
[0198] In the embodiment of the present application, according to the above network status indicators, the following strategy for dynamically adjusting the size of the data packet can be formulated:
[0199] 1) High latency and high jitter: Reduce the packet size (S) to reduce the problem of large packets taking too long to transmit in the network.
[0200] 2) High packet loss rate: Reduce the packet size (S) to reduce the impact of packet loss and reduce retransmission costs.
[0201] 3) Abundant bandwidth, low latency and packet loss rate: Increase the data packet size (S), make full use of the bandwidth, and improve transmission efficiency.
[0202] For example, an algorithm for dynamically adjusting packet size could look like this:
[0203] def adjust_packet_size(latency,packet_loss_rate,bandwidth,jitter):
[0204] # Initial parameters
[0205] S_min=512#Minimum data packet size
[0206] S_max=4096#Maximum data packet size
[0207] S_current=1024#Current data packet size
[0208] #Adjust based on delay and jitter
[0209] if latency>100or jitter>20:
[0210] S_current=max(S_min,S_current / / 2)
[0211] #Adjust according to packet loss rate
[0212] elif packet_loss_rate>0.05:
[0213] S_current=max(S_min,S_current / / 2)
[0214] #Adjust according to bandwidth
[0215] elif bandwidth>100*1024*1024:#Bandwidth is greater than 100Mbps
[0216] S_current=min(S_max,S_current*2)
[0217] else:
[0218] S_current=max(S_min,min(S_max,S_current))
[0219] return S_current
[0220] #Adjust the packet size based on the real-time measured network conditions
[0221] latency=measure_rtt('example.com')
[0222] packet_loss_rate=calculate_packet_loss_rate()
[0223] bandwidth=measure_bandwidth()
[0224] jitter = calculate_jitter()
[0225] new_packet_size=adjust_packet_size(latency,packet_loss_rate,bandwidth,jitter)print(f"Adjusted Packet Size:{new_packet_size}bytes")
[0226] The embodiments of the present application use the above-mentioned method and related algorithms to monitor network conditions in real time and dynamically adjust the size of data packets to ensure data transmission efficiency and reliability in different network environments.
[0227] The data packet size in the embodiments of the present application depends on the MTU (Maximum Transmission Unit) size of the network. Typically, the MTU in Ethernet is 1500 bytes, but this value may vary on different networks. There is no fixed regulation for the data packet size, but in order to improve the efficiency of the network, the data packet size is generally not larger than the MTU size, that is, after removing the IP (Internet Protocol) header and the UDP header, the data payload size cannot exceed 1500-20-8=1472 bytes.
[0228] Reference Figure 4 , is a flow chart of dynamically adjusting the data packet size of the present application, which specifically includes: the sending end first monitors the network status, then adjusts the data packet size according to the monitoring results, and divides the data packet into packets according to the data packet size to adapt to different network environments and improve the efficiency and reliability of data transmission.
[0229] Step 302: Divide the target data into a plurality of data packets to be verified according to the size of the data packets, and send the plurality of data packets to be verified to the receiving end, so that the receiving end verifies the plurality of data packets to be verified and combines the data packets to be verified that pass the verification; the size of the data packets to be verified is the same as the size of the data packets;
[0230] In the embodiment of the present application, the transmitting end divides the target data into multiple data packets to be verified according to the dynamically adjusted data packet size, and sends these data packets to the receiving end. Specifically, the transmitting end divides the target data into multiple data packets to be verified according to the adjusted data packet size, and sends the divided data packets to be verified to the receiving end, and the receiving end verifies the received data packets to be verified, and combines the data packets that pass the verification into complete verification data.
[0231] At the transmitting end, the target data is divided into multiple data packets to be verified according to the data packet size, and each data packet to be verified includes a packet header and a packet body, and the packet header includes information such as the packet sequence number, the total number of packets, and the verification code. In order to improve transmission efficiency and reliability, the embodiment of the present application can also consider the packet header overhead in the calculation.
[0232] In one embodiment of the present application, when a transmitting end sends a data packet to a receiving end, the data packet transmission may be performed on the same network or multiple networks.
[0233] In one embodiment of the present application, in order to improve data transmission efficiency, it is also possible to consider compressing the data packet for transmission. Then, after receiving the data packet, the receiving end needs to decompress and then verify it, which will result in an additional compression and decompression process.
[0234] Step 303: When a retransmission signal sent by the receiving end is received, the to-be-verified data packet corresponding to the retransmission signal is resent to the receiving end, so that the receiving end verifies the to-be-verified data packet corresponding to the retransmission signal.
[0235] If the receiving end does not receive all the data packets within the preset time, it will send a retransmission signal to the sending end, requesting the sending end to resend the data packets that have not been received. After receiving the retransmission signal, the sending end will resend the data packets to be verified corresponding to the retransmission signal to the receiving end. Specifically, the sending end receives the retransmission signal sent by the receiving end, and resends the data packets to be verified that have not been received according to the retransmission signal. The receiving end verifies the received retransmission data packets to ensure the integrity and accuracy of data transmission.
[0236] Assume that the sender wants to send a target data, which contains the following information:
[0237] Target data: 1000 bytes
[0238] Network conditions: high latency, low packet loss, low bandwidth
[0239] Then, the sender and receiver will do the following:
[0240] The sender will adjust the data packet size to 250 bytes according to the current network conditions; the sender divides the target data into 4 data packets to be verified, each of which is 250 bytes in size; the sender sends these 4 data packets to be verified to the receiver; assuming that the receiver does not receive the third data packet within the preset time, it sends a retransmission signal to the sender, requesting the third data packet to be resent; after receiving the retransmission signal, the sender resends the third data packet; the receiver verifies the received third data packet to ensure the integrity and accuracy of data transmission.
[0241] The sending end in the embodiment of the present application can adapt to different network environments, such as high latency, high packet loss rate, low bandwidth, etc., by dynamically adjusting the data packet size, which can improve the flexibility and adaptability of data transmission and ensure that data can be effectively transmitted under various network conditions; and, by reasonably dividing the data packet size, it is possible to fully utilize the network bandwidth, reduce the data transmission time, improve the efficiency of data transmission, and reduce the transmission delay of data packets in the network; in addition, through the retransmission mechanism, the fault tolerance capability of data transmission is enhanced to ensure that data transmission can still be completed in the event of network instability or data packet loss, thereby avoiding the failure of the entire data transmission process due to a single data packet error.
[0242] In one embodiment of the present application, the network status is determined according to network parameters, and the network parameters include delay, packet loss rate, bandwidth and jitter. The step 301 of adjusting the data packet size according to the network status includes:
[0243] Multiplying the network parameter and the weight corresponding to the network parameter to obtain weight scores corresponding to the plurality of network parameters;
[0244] Adding weight scores corresponding to the plurality of network parameters to obtain a target weight score;
[0245] When the target weight score exceeds a weight threshold, increasing the data packet size;
[0246] When the target weight score does not exceed the weight threshold, the data packet size is reduced.
[0247] In an embodiment of the present application, the network status can be determined based on delay, packet loss rate, bandwidth and jitter, and the data packet size can be adjusted according to the network status. Specifically, the sending end sets a weight for each network parameter (delay, packet loss rate, bandwidth and jitter), and multiplies each network parameter by the corresponding weight to obtain a weight score for each network parameter. The sending end adds the weight scores of all network parameters to obtain a comprehensive target weight score. If the target weight score exceeds the preset weight threshold, the sending end will increase the size of the data packet to make full use of the network bandwidth and reduce delay. If the target weight score does not exceed the preset weight threshold, the sending end will reduce the size of the data packet to reduce the impact of packet loss rate and jitter on data transmission.
[0248] Assume that the weights corresponding to each network parameter are: delay weight 0.3, packet loss rate weight 0.3, bandwidth weight 0.2, and jitter weight 0.2;
[0249] Assume the weight threshold is 45;
[0250] Assume that the network parameters monitored by the sender are: latency is 100 milliseconds, packet loss rate is 5%, bandwidth is 100 Mbps, and jitter is 20 milliseconds;
[0251] The calculation results are: delay weight score = 100*0.3 = 30, packet loss rate weight score = 5*0.3 = 1.5, bandwidth weight score = 100*0.2 = 20, jitter weight score = 20*0.2 = 4, target weight score = 30+1.5+20+4=55.5;
[0252] The target weight score of 55.5 exceeds the weight threshold of 45, at which point the sender increases the size of the data packet.
[0253] The sending end in the embodiment of the present application can dynamically adjust the data packet size to improve the efficiency and reliability of data transmission by setting weights, calculating weight scores, adding weight scores, setting weight thresholds and judging target weight scores.
[0254] In one embodiment of the present application, dividing the target data into a plurality of data packets to be verified according to the size of the data packet includes:
[0255] Determine the number of data packets according to the length of the target data and the size of the data packet;
[0256] The target data is divided into a plurality of data packets to be verified based on the number of the data packets; the number of the data packets to be verified is the same as the number of the data packets.
[0257] In the embodiment of the present application, when the target data is divided into multiple data packets, the number of data packets needs to be determined. The number of data packets can be determined by the following formula:
[0258] N=\left\lceil\frac{L}{S}\right\rceil
[0259] Where L is the length of the target data (in bytes), S is the packet size (in bytes), \left\lceil x\right\rceil is a round-up operation, which means rounding the decimal part up to the nearest integer, and frac{x}{y} is used to represent a fraction, {x} is the numerator, and {y} is the denominator.
[0260] Example calculation: Assuming that the total length of the data to be transmitted is 1500 bytes and the size of each data packet is 512 bytes, the number of data packets N is calculated as follows: [N=\left\lceil\frac{1500}{512}\right\rceil], calculate the fractional part: [\frac{1500}{512}\approx2.9297] round up: [\left\lceil 2.9297\right\rceil=3], therefore, 3 data packets are required to transmit 1500 bytes of data.
[0261] In one embodiment of the present application, the method further includes:
[0262] Determine the preset time according to the network status;
[0263] The preset time is sent to the receiving end so that the receiving end determines whether the to-be-checked data packet received within the preset time is complete.
[0264] In an embodiment of the present application, the transmitting end determines a preset time according to the current network conditions (such as delay, packet loss rate, bandwidth, jitter, etc.). The preset time means that the receiving end starts timing after receiving the first data packet and waits to receive all data packets within the preset time. Subsequently, the transmitting end sends the determined preset time to the receiving end so that the receiving end can determine whether the received data packets to be verified are complete within the preset time. If all data packets are not received within the preset time, the receiving end will consider that some data packets are lost and trigger the retransmission mechanism.
[0265] The sending end in the embodiment of the present application can adapt to different network environments, such as high latency, high packet loss rate, low bandwidth, etc., by dynamically adjusting the data packet size, which can improve the flexibility and adaptability of data transmission and ensure that data can be effectively transmitted under various network conditions; and, by reasonably dividing the data packet size, it is possible to fully utilize the network bandwidth, reduce the data transmission time, improve the efficiency of data transmission, and reduce the transmission delay of data packets in the network; in addition, through the retransmission mechanism, the fault tolerance capability of data transmission is enhanced to ensure that data transmission can still be completed in the event of network instability or data packet loss, thereby avoiding the failure of the entire data transmission process due to a single data packet error.
[0266] It should be noted that, for the method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited by the described order of actions, because according to the embodiments of the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present application.
[0267] On the basis of the above embodiments, this embodiment further provides a data transmission device, which is applied to electronic devices such as terminal devices and servers.
[0268] Reference Figure 5 , shows a structural block diagram of an embodiment of a data transmission device of the present application, which is applied to a receiving end, and the receiving end is connected to a sending end for communication, and may specifically include the following modules:
[0269] The receiving module 501 is used to receive the target data sent by the sending end;
[0270] A verification module 502 is used to verify a plurality of to-be-verified data packets in the target data, and determine a to-be-verified data packet that passes the verification as a first data packet;
[0271] A combining module 503, configured to combine a plurality of the first data packets into verification data;
[0272] A comparison module 504 is used to compare the verification data with the target data to determine whether the verification data and the target data are consistent;
[0273] The judgment module 505 is used to judge that the target data transmission is successful if the verification data is consistent with the target data; or judge that the target data transmission fails if the verification data is inconsistent with the target data.
[0274] Reference Figure 6 , shows a structural block diagram of another data transmission device embodiment of the present application, which is applied to a sending end, and the sending end is connected to a receiving end for communication, and specifically may include the following modules:
[0275] An adjustment module 601 is used to adjust the size of a data packet according to a network condition; the network condition is used to characterize the network environment during data transmission;
[0276] A division module 602 is used to divide the target data into a plurality of data packets to be verified according to the size of the data packet, and send the plurality of data packets to be verified to the receiving end, so that the receiving end verifies the plurality of data packets to be verified and combines the data packets to be verified that pass the verification; the size of the data packets to be verified is the same as the size of the data packet;
[0277] The retransmission module 603 is used to resend the data packet to be verified corresponding to the retransmission signal to the receiving end when receiving the retransmission signal sent by the receiving end, so that the receiving end can verify the data packet to be verified corresponding to the retransmission signal.
[0278] The embodiment of the present application also provides a non-volatile readable storage medium, which stores one or more modules (programs). When the one or more modules are applied to a device, the device can execute instructions (instructions) of each method step in the embodiment of the present application.
[0279] The present application embodiment provides one or more machine-readable media on which instructions are stored, and when executed by one or more processors, an electronic device executes one or more of the methods described in the above embodiments. In the present application embodiment, the electronic device includes various types of devices such as terminal devices and servers (clusters).
[0280] The embodiments of the present disclosure may be implemented as a device configured as desired using any appropriate hardware, firmware, software, or any combination thereof, and the device may include electronic devices such as terminal devices and servers (clusters). Figure 7 An exemplary apparatus 700 that can be used to implement various embodiments described in this application is schematically illustrated.
[0281] For one embodiment, Figure 7 An exemplary apparatus 700 is shown having one or more processors 702, a control module (chip set) 704 coupled to at least one of the processor(s) 702, a memory 706 coupled to the control module 704, a non-volatile memory (NVM) / storage device 708 coupled to the control module 704, one or more input / output devices 710 coupled to the control module 704, and a network interface 712 coupled to the control module 704.
[0282] The processor 702 may include one or more single-core or multi-core processors, and the processor 702 may include any combination of general-purpose processors or special-purpose processors (such as graphics processors, application processors, baseband processors, etc.). In some embodiments, the device 700 can be used as a terminal device, server (cluster), etc. described in the embodiments of the present application.
[0283] In some embodiments, the apparatus 700 may include one or more computer-readable media (e.g., memory 706 or NVM / storage device 708) having instructions 714 and one or more processors 702 combined with the one or more computer-readable media and configured to execute the instructions 714 to implement a module to perform the actions described in the present disclosure.
[0284] For one embodiment, the control module 704 may include any suitable interface controller to provide any suitable interface to at least one of the processor(s) 702 and / or any suitable device or component in communication with the control module 704 .
[0285] The control module 704 may include a memory controller module to provide an interface to the memory 706. The memory controller module may be a hardware module, a software module, and / or a firmware module.
[0286] The memory 706 may be used, for example, to load and store data and / or instructions 714 for the device 700. For one embodiment, the memory 706 may include any suitable volatile memory, such as a suitable DRAM. In some embodiments, the memory 706 may include double data rate type four synchronous dynamic random access memory (DDR4 SDRAM).
[0287] For one embodiment, control module 704 may include one or more input / output controllers to provide an interface to NVM / storage device 708 and input / output device(s) 710 .
[0288] For example, NVM / storage 708 may be used to store data and / or instructions 714. NVM / storage 708 may include any suitable non-volatile memory (e.g., flash memory) and / or may include any suitable non-volatile storage device(s) (e.g., one or more hard disk drives (HDDs), one or more compact disk (CD) drives, and / or one or more digital versatile disk (DVD) drives).
[0289] NVM / storage device 708 may include storage resources that are physically part of the device on which apparatus 700 is installed, or it may be accessible to the device without being part of the device. For example, NVM / storage device 708 may be accessed via input / output device(s) 710 over a network.
[0290] (One or more) input / output devices 710 may provide an interface for the apparatus 700 to communicate with any other appropriate device, and the input / output device 710 may include a communication component, an audio component, a sensor component, etc. The network interface 712 may provide an interface for the apparatus 700 to communicate through one or more networks, and the apparatus 700 may wirelessly communicate with one or more components of a wireless network according to any of one or more wireless network standards and / or protocols, for example, accessing a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G, 5G, etc., or a combination thereof for wireless communication.
[0291] For one embodiment, at least one of the processor(s) 702 may be packaged together with the logic of one or more controllers (e.g., a memory controller module) of the control module 704. For one embodiment, at least one of the processor(s) 702 may be packaged together with the logic of one or more controllers of the control module 704 to form a system-in-package (SiP). For one embodiment, at least one of the processor(s) 702 may be integrated on the same die with the logic of one or more controllers of the control module 704. For one embodiment, at least one of the processor(s) 702 may be integrated on the same die with the logic of one or more controllers of the control module 704 to form a system-on-chip (SoC).
[0292] In various embodiments, the apparatus 700 may be, but is not limited to, a terminal device such as a server, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet computer, a netbook, etc.). In various embodiments, the apparatus 700 may have more or fewer components and / or a different architecture. For example, in some embodiments, the apparatus 700 includes one or more cameras, a keyboard, a liquid crystal display (LCD) screen (including a touch screen display), a non-volatile memory port, multiple antennas, a graphics chip, an application-specific integrated circuit (ASIC), and a speaker.
[0293] Among them, the main control chip can be used as a processor or control module in the detection device, sensor data, location information, etc. are stored in a memory or NVM / storage device, the sensor group can be used as an input / output device, and the communication interface may include a network interface.
[0294] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0295] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0296] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data transmission terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data transmission terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0297] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data transmission terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0298] These computer program instructions can also be loaded onto a computer or other programmable data transmission terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0299] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.
[0300] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0301] The above is a detailed introduction to a data transmission method and device, an electronic device and a storage medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A data transmission method, characterized in that: Applied to a receiving end, the receiving end is communicatively connected with a sending end, and the method comprises: Receiving target data sent by the sending end; Verifying a plurality of to-be-verified data packets in the target data, and determining a to-be-verified data packet that passes the verification as a first data packet; combining a plurality of the first data packets into verification data; Comparing the verification data with the target data to determine whether the verification data and the target data are consistent; If the verification data is consistent with the target data, it is determined that the target data transmission is successful; or if the verification data is inconsistent with the target data, it is determined that the target data transmission fails.
2. The method according to claim 1, characterized in that The step of verifying a plurality of data packets to be verified in the target data and determining a data packet to be verified that passes the verification as a first data packet includes: Adding the pseudo header, header and data message in the data packet to be checked in sequence to obtain first data corresponding to the data packet to be checked; Invert the first data corresponding to the data packet to be verified to obtain the second data corresponding to the data packet to be verified; If the second data corresponding to the data packet to be verified is the same as the verification code corresponding to the data packet to be verified, the data packet to be verified is determined to be the first data packet.
3. The method according to claim 1, characterized in that After verifying the multiple data packets to be verified in the target data and determining the verified data packet to be verified as the first data packet, the method further includes: Determine the to-be-verified data packet that fails the verification as the second data packet; Sending a retransmission signal for the second data packet to the transmitting end, so that the transmitting end resends the second data packet based on the retransmission signal of the second data packet; receiving the second data packet sent by the sending end; The second data packet is verified, and a second data packet that passes the verification is determined as the first data packet.
4. The method according to claim 3, characterized in that: The combining the plurality of the first data packets into verification data comprises: When the number of the first data packets is the same as the number of the data packets to be verified, a plurality of the first data packets are combined into the verification data according to the packet sequence numbers corresponding to the first data packets.
5. The method according to claim 1, characterized in that The method further comprises: When the number of the first data packets and the number of the data packets to be checked within the preset time are different, the missing data packets to be checked are determined as the third data packets according to the packet sequence numbers corresponding to the first data packets; Sending a retransmission signal for the third data packet to the transmitting end, so that the transmitting end retransmits the third data packet based on the retransmission signal of the third data packet; Receiving the third data packet sent by the sending end; The third data packet is verified, and the third data packet that passes the verification is determined as the first data packet.
6. A data transmission method, characterized in that: Applied to a sending end, the sending end is communicatively connected with a receiving end, and the method comprises: Adjusting the size of the data packet according to the network status; the network status is used to characterize the network environment during data transmission; Dividing the target data into a plurality of data packets to be verified according to the size of the data packets, and sending the plurality of data packets to be verified to the receiving end, so that the receiving end verifies the plurality of data packets to be verified and combines the data packets to be verified that pass the verification; the size of the data packets to be verified is the same as the size of the data packets; When a retransmission signal sent by the receiving end is received, the to-be-verified data packet corresponding to the retransmission signal is resent to the receiving end, so that the receiving end verifies the to-be-verified data packet corresponding to the retransmission signal.
7. The method according to claim 6, characterized in that The network condition is determined according to network parameters, wherein the network parameters include delay, packet loss rate, bandwidth and jitter, and the adjusting the data packet size according to the network condition includes: Multiplying the network parameter and the weight corresponding to the network parameter to obtain weight scores corresponding to the plurality of network parameters; Adding weight scores corresponding to the plurality of network parameters to obtain a target weight score; When the target weight score exceeds a weight threshold, increasing the data packet size; When the target weight score does not exceed the weight threshold, the data packet size is reduced.
8. The method according to claim 6, characterized in that The step of dividing the target data into a plurality of data packets to be verified according to the size of the data packet comprises: Determine the number of data packets according to the length of the target data and the size of the data packet; The target data is divided into a plurality of data packets to be verified based on the number of the data packets; the number of the data packets to be verified is the same as the number of the data packets.
9. The method according to claim 6, characterized in that The method further comprises: Determine the preset time according to the network status; The preset time is sent to the receiving end so that the receiving end determines whether the to-be-checked data packet received within the preset time is complete.
10. A data transmission device, characterized in that: Applied to a receiving end, the receiving end is communicatively connected with a sending end, and the device comprises: A receiving module, used for receiving target data sent by the sending end; A verification module, used for verifying a plurality of to-be-verified data packets in the target data, and determining a to-be-verified data packet that passes the verification as a first data packet; A combining module, used for combining a plurality of the first data packets into verification data; A comparison module, used to compare the verification data with the target data to determine whether the verification data and the target data are consistent; The judgment module is used to judge that the target data transmission is successful if the verification data is consistent with the target data; or judge that the target data transmission is failed if the verification data is inconsistent with the target data.
11. A data transmission device, characterized in that: Applied to a sending end, the sending end is connected to a receiving end for communication, and the device comprises: An adjustment module, used for adjusting the size of a data packet according to a network condition; the network condition is used for characterizing a network environment during data transmission; a division module, used for dividing the target data into a plurality of data packets to be verified according to the size of the data packet, and sending the plurality of data packets to be verified to the receiving end, so that the receiving end verifies the plurality of data packets to be verified and combines the data packets to be verified that pass the verification; the size of the data packets to be verified is the same as the size of the data packet; The retransmission module is used to resend the to-be-verified data packet corresponding to the retransmission signal to the receiving end when receiving the retransmission signal sent by the receiving end, so that the receiving end can verify the to-be-verified data packet corresponding to the retransmission signal.
12. An electronic device, characterized in that: include: processor; and A memory having executable codes stored thereon, which, when executed, enables the processor to execute the data transmission method as described in any one of claims 1-5 or 6-9.
13. One or more machine-readable media having executable codes stored thereon, which, when executed, cause a processor to execute the data transmission method according to any one of claims 1-5 or 6-9.
Citation Information
Patent Citations
Verification method of data transmission
CN106656424A
Data rolling transmission receiving method and device
CN110299973A
Trusted communication method and system based on UDP (User Datagram Protocol)
CN115499173A
Government affair cloud multi-source data transmission detection system and method
CN118842766A
Cited By
Verification retransmission method for single-cycle multiple data packets, electronic equipment and medium
CN120528563A
Data transmission method and electronic equipment
CN121585327A