Data transmission method and system

By setting the interface function and data packet segmentation model in the data transmission method, the big data packet is divided into multiple data segments and transmitted simultaneously, the problem of data loss easily caused by big data packet transmission in the prior art is solved, and efficient and complete data transmission is achieved.

CN120066811APending Publication Date: 2025-05-30SANYUN (HUBEI) DIGITAL TECHNOLOGY CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411901160.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-23
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

Existing data transmission methods can easily lead to data loss when transmitting large data packets, resulting in data transmission failure.

Method used

By setting the interface function, calling the function interface to receive data packets, judging the data packet type, setting appropriate interface functions based on the data packet type, dividing different types of data packets into multiple data segments, and synchronizing each data segment to the target client through the interface function.

Benefits of technology

It improves the packet transmission speed, while ensuring the integrity of the packet, avoiding the problem of data loss.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120066811A_ABST
    Figure CN120066811A_ABST
Patent Text Reader

Abstract

The invention relates to a data transmission method and system, and the method comprises the steps: setting an interface function, calling a function interface, receiving a data package based on the interface function, judging the type of the received data package, and setting a proper interface function based on the type of the data package. And finally, dividing the different types of data packets into a plurality of data segments in combination with the interface function, and transmitting each data segment to the corresponding target client. The data packet can be divided into a plurality of data segments, and each data segment is synchronized through the interface function, so that the data packet synchronization efficiency is improved. Therefore, the integrity of the data packet is ensured on the premise of improving the transmission speed of the data packet.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of data transmission, and particularly to a data transmission method and system. Background Art

[0002] Data transmission is to transfer data from a data source to a data terminal through one or more data links according to certain rules. Its main function is to realize the information transmission and exchange between points. A good data transmission method can improve the real-time performance and reliability of data transmission. The data transmission part plays an important role in the whole system, which is equivalent to the nerves of the human body transmitting signals to various parts of the body. How to efficiently, accurately and timely transmit the data information collected by the acquisition module is an important issue.

[0003] Due to the need to transmit large data packets, but the existing data transmission methods often divide large data packets into multiple small data packets and then transmit them in segments. However, data loss may occur during the data transmission process, resulting in data transmission failure. Summary of the Invention

[0004] Based on this, in view of the problem that the existing data transmission methods often divide large data packets into multiple small data packets and then transmit them in segments, but data loss may occur during the data transmission process, resulting in data transmission failure, it is necessary to provide a data transmission method and system.

[0005] On the one hand, this application provides a data transmission method, including:

[0006] Set an interface function;

[0007] Call the function interface and receive data packets based on the interface function;

[0008] Judge the type of the received data packet and set a suitable interface function based on the data packet type;

[0009] Combine the interface function to divide different types of data packets into multiple data segments and transmit each data segment to the corresponding target client.

[0010] On the other hand, this application also provides a data transmission system, which includes:

[0011] A sending end;

[0012] A receiving end;

[0013] A server, where both the sending end and the receiving end are communicatively connected to the server. The server receives the data packets sent by the sending end and executes the data transmission method as described above to send the data packets to the receiving end.

[0014] This application relates to a data transmission method and system. The data transmission method sets interface functions, calls function interfaces, receives data packets based on the interface functions, then determines the types of the received data packets, sets appropriate interface functions based on the data packet types, and finally divides different types of data packets into multiple data segments in combination with the interface functions and transmits each data segment to the corresponding target client. This application can divide data packets into multiple data segments and synchronize each data segment through the interface functions, thereby ensuring the integrity of the data packets on the premise of improving the data packet transmission speed. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 It is a schematic flowchart of a data transmission method provided by an embodiment of this application.

[0016] Figure 2 It is a schematic structural diagram of a data transmission system provided by an embodiment of this application.

[0017] REFERENCE SIGNS:

[0018] 100, sending end; 200, receiving end; 300, processor. DETAILED DESCRIPTION

[0019] In order to make the objectives, technical solutions and advantages of this application clearer, the following further elaborates on this application in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not used to limit this application.

[0020] This application provides a data transmission method and system.

[0021] As Figure 1 shown, in an embodiment of this application, a data transmission method is provided. The data transmission method includes:

[0022] S100, set interface functions;

[0023] S200, call the function interface and receive data packets based on the interface function;

[0024] S300, determine the types of the received data packets and set appropriate interface functions based on the data packet types;

[0025] S400, divide different types of data packets into multiple data segments in combination with the interface functions and transmit each data segment to the corresponding target client.

[0026] In this embodiment, by setting an interface function and calling the function interface, receiving a data packet based on the interface function, then determining the type of the received data packet, setting a suitable interface function based on the data packet type, and finally dividing different types of data packets into multiple data segments in combination with the interface function and transmitting each data segment to the corresponding target client. This application can divide the data packet into multiple data segments and synchronize each data segment through the interface function, so as to ensure the integrity of the data packet on the premise of improving the data packet transmission speed.

[0027] In an embodiment of the present application, the interface function includes a read function and a write function.

[0028] In this embodiment, the content included in the data packet sent by the sending end is read through the read function, and the content in the data packet is written to the receiving end through the write function.

[0029] In an embodiment of the present application, the write function includes a probe head and a guiding head. The guiding head is arranged at the head of the data packet, and the probe head is parallel to the data packet and transmitted synchronously with the data packet.

[0030] Specifically, the guiding head includes a transmission address and a transmission time.

[0031] The creation rule of the probe head can be serial number + time + digital coding corresponding to the length of the data packet / data segment.

[0032] In this embodiment, when calling the write function, it includes two parts, namely the probe head and the guiding head. Among them, the guiding head is used to import the data packet or data segment to the correct receiving address so that the data packet can be transmitted to the correct receiving end, while the probe head is sent synchronously with the data packet or data segment to facilitate subsequent confirmation of missing data packets or data segments.

[0033] In an embodiment of the present application, the S200 includes:

[0034] S210, obtaining a data transfer request.

[0035] S220, calling the read function to read the data transfer request to obtain the data transfer target address and the data packet content.

[0036] In this embodiment, by calling the read function to read the content included in the data packet, the data transfer target address of the data packet can be determined, and it is convenient to write the guiding head to the data packet subsequently.

[0037] In an embodiment of the present application, the S300 includes:

[0038] S310, setting a data packet length threshold.

[0039] Specifically, since data packets are transmitted in byte form during transmission, a byte count threshold can be set as the data packet length threshold.

[0040] S320, receive a data packet.

[0041] S330, calculate the length of the content of the received data packet, and determine whether the length of the content of the received data packet is greater than or equal to the data packet length threshold.

[0042] S340, if the length of the content of the received data packet is greater than or equal to the data packet length threshold, define the data packet as a long data packet.

[0043] S350, if the length of the content of the received data packet is less than the data packet length threshold, define the data packet as a short data packet.

[0044] In this embodiment, during data transmission, there are small data packets and large data packets. For small data packets, since they contain less content, they can be transmitted in one go, so there is no need to segment small data packets.

[0045] However, for large data packets, since they contain a large amount of data, it takes a long time to transmit them. But this may lead to data loss during transmission. Therefore, by segmenting large data packets and transmitting multiple data segments simultaneously, the transmission time can be saved.

[0046] Therefore, before data transmission, it is necessary to first define large data packets and small data packets, and judge large data packets and small data packets through the self-set data packet length threshold. When the length of the data packet is greater than or equal to the data packet length threshold, the data packet is defined as a long data packet, and when the length of the data packet is less than the data packet length threshold, the data packet is defined as a short data packet.

[0047] Since the data packet length threshold is self-set, the division of long data packets and short data packets is relatively flexible. By adjusting the size of the data packet length threshold, the judgment criteria for long data packets and short data packets can be adjusted.

[0048] In an embodiment of the present application, the S400 includes:

[0049] S410, call the data packet segmentation model.

[0050] S420, input the long data packet into the data packet segmentation model to divide the long data packet into multiple equal-length data segments.

[0051] S430, call the header of the writing function to add a header to the beginning of each data segment, obtaining multiple header data segments.

[0052] S440, call the probe head of the writing function to create multiple probe heads, add a header to the beginning of each probe head, obtaining multiple header probe heads, and set each header probe head parallel to each header data segment.

[0053] S450, send the header probe head and the header data packet in parallel, and determine whether each header probe head is received.

[0054] S460, if each header probe head is received, confirm that the data packet transmission is completed.

[0055] In this embodiment, since the long data packet has a large amount of data, it takes a long transmission time for the long data packet. In this way, not only is it easy to have the problem of data loss, but also it takes a long transmission time.

[0056] Therefore, the long data packet is divided into multiple equal-length data segments through the data packet segmentation model, and the multiple equal-length data segments are sent synchronously, thereby reducing the data transmission time. Moreover, since a header probe head for parallel transmission is set for each data segment, after receiving multiple data segments, the multiple data segments can be restored to the original data packet according to the header probe head.

[0057] For example, if the data packet R is received and its data length is greater than the data length threshold, then the data packet R is a long data packet.

[0058] Input the data packet R into the data packet segmentation model, thereby dividing the data packet R into data segments A, B, and C.

[0059] Then call the header of the writing function to add headers to data segments A, B, and C respectively, obtaining three header data segments ADD+A, ADD+B, and ADD+C, and set a header probe head ADD+TestA1, ADD+TestB2, and ADD+TestC3 for each header data segment respectively.

[0060] Send ADD+A, ADD+B, and ADD+C simultaneously. When sending each header data segment, also send its corresponding header probe head synchronously.

[0061] In an embodiment of the present application, the S400 further includes:

[0062] S470, if not all header probe heads are received, determine the missing header probe heads and check whether the corresponding header data segments are received.

[0063] S480, if the corresponding guiding data segment is received, confirm that the data packet transmission is completed.

[0064] S490, if the corresponding guiding data segment is not received, retransmit the guiding data segment and insert the guiding data segment into its original position.

[0065] In this embodiment, since there is a situation of data loss during data transmission, and each data segment has its corresponding unique guiding probe, after the data transmission is completed, it is possible to judge whether the data segment is received by judging whether the guiding probe is received, and judge whether the data segment is complete by judging whether the guiding data header is complete.

[0066] The reason for judging by the guiding probe instead of directly judging the data segment is that the guiding probe contains less valid content. Although its data length is equal to the length of the corresponding data segment, only the guiding header part and the serial number part of each guiding probe are valid. Therefore, it is only necessary to identify these two parts to judge whether the guiding probe is received, thereby reducing the identification time.

[0067] In an embodiment of the present application, before the S400, it includes:

[0068] K100, create a data packet segmentation model and set segmentation rules. The data packet segmentation model is set in the transport layer.

[0069] Specifically, the segmentation rule can be to set the length of each data segment, and starting from the header of the data packet, disconnect the data packet every set data segment length.

[0070] Under this segmentation rule, it can be ensured that the lengths of other data segments except the last data segment are the same. To ensure that the lengths of each data segment are equal, the length of the last data segment can be filled to the set data segment length by padding bits.

[0071] K110, obtain multiple training data packets, and divide each training data packet into multiple data segments according to the set segmentation rules. Dividing each training data packet into multiple data segments according to the set segmentation rules is denoted as verification data segments.

[0072] K120, divide multiple training data packets into a training set and a test set.

[0073] Specifically, the number of training data packets in the training set is greater than the number of training data packets in the test set.

[0074] K130, sequentially input the training data packets in the training set into the data packet segmentation model to train the data packet segmentation model, and the data packet segmentation model outputs multiple data segments divided from each training data packet. Denote the multiple data segments divided from each training data packet output by the data packet segmentation model as the actual data segments.

[0075] K140, determine whether the actual data segments are the same as the verification data segments.

[0076] K150, if the actual data segments are the same as the verification data segments, it is considered that the training of the data packet segmentation model is completed, and the trained data packet segmentation model is obtained.

[0077] K160, if the actual data segments are not the same as the verification data segments, return to K110 until the actual data segments are the same as the verification data segments, and the trained data packet segmentation model is obtained.

[0078] Specifically, after returning to K110, the proportion of the training set should be increased, so as to increase the number of training data packets in the training set, and thus improve the training effect.

[0079] In this embodiment, before dividing the data packet into multiple data segments through the data packet segmentation model, it is necessary to first train the data packet segmentation model, so that the data packet segmentation model has the ability to automatically divide the input training packet into multiple equal-length data segments.

[0080] In an embodiment of the present application, the data transmission method further includes:

[0081] S500, calculate the total length of all received data segments.

[0082] S510, determine whether the total length of all received data segments is equal to the length of the data packet.

[0083] S520, if the total length of all received data segments is equal to the length of the data packet, define that this data transmission is completed.

[0084] S530, if the total length of all received data segments is not equal to the length of the data packet, define that this data transmission fails.

[0085] In this embodiment, in the foregoing embodiment, it is judged whether each corresponding data segment is successfully received through the guiding probe, but this judgment method only judges at the level of the number of data segments. Since some data segments may be lost during the data transmission process, it is impossible to judge whether the data packet is complete only by verifying the number of data segments in this case.

[0086] Therefore, to solve the problem of partial loss of data segments, this application determines whether a data packet is complete by verifying whether the total length of all data segments is equal to the length of the original data packet. If the total length of all data segments is equal to the length of the original data packet, it means that no data loss occurred during data transmission.

[0087] Since only the lengths of the data segments and the data packet need to be verified, this verification method is relatively simple and can be verified efficiently, thus avoiding affecting subsequent data transmission.

[0088] As Figure 2 shown, in an embodiment of this application, a data transmission system is further provided. The data transmission system includes a sending end 100, a receiving end 200, and a server 300.

[0089] Both the sending end 100 and the receiving end 200 are communicatively connected to the server 300. The server 300 receives the data packet sent by the sending end 100 and executes the data transmission method described in the foregoing embodiment on the data packet to send the data packet to the receiving end 200.

[0090] Specifically, for the sake of concise writing, reference numerals are only used in the relevant embodiments of the data transmission system.

[0091] The sending end 100 may be a mobile communication device, such as a mobile phone, or a device such as a computer.

[0092] In this embodiment, the user sends data from the sending end 100 to the receiving end 200. The data sent will first be transmitted into the processor 300. After receiving the transmission data from the sending end 100, the processor 300 executes the data transmission method described in the foregoing embodiment on the data packet, thereby transmitting the data packet containing the data to the receiving end 200, thus completing the data transmission process.

[0093] The technical features of the above-described embodiments can be combined arbitrarily, and there is no limitation on the execution order of the method steps. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as these combinations of technical features do not conflict, they should all be considered as within the scope described in this specification.

[0094] The above-described embodiments only represent several implementation manners of this application. Their descriptions are relatively specific and detailed, but they should not be construed as limiting the patent scope of this application. It should be noted that for those of ordinary skill in the art, without departing from the concept of this application, several modifications and improvements can still be made, and these all belong to the protection scope of this application. Therefore, the protection scope of this application should be subject to the appended claims.

Claims

1. A data transmission method, characterized in that: The data transmission method comprises: Set the interface function; Call the function interface and receive data packets based on the interface function; Determine the type of data packet received and set the appropriate interface function based on the data packet type; Different types of data packets are divided into multiple data segments in combination with the interface function, and each data segment is transmitted to the corresponding target client.

2. The data transmission method according to claim 1, characterized in that: The interface function includes a read function and a write function.

3. The data transmission method according to claim 2, characterized in that: The write function includes a test probe and a guide head, wherein the guide head is arranged at the header of the data packet, and the test probe is parallel to the data packet and is transmitted synchronously with the data packet.

4. The data transmission method according to claim 3, characterized in that: The calling function interface receives a data packet based on the interface function, including: Get data transfer request; Call the read function to read the data transfer request to obtain the data transmission target address and data packet content.

5. The data transmission method according to claim 4, characterized in that: The determining the data packet type and setting a suitable interface function based on the data packet type include: Set the packet length threshold; Receive data packets; Calculate the length of the received data packet content, and determine whether the length of the received data packet content is greater than or equal to the data packet length threshold; If the length of the received data packet content is greater than or equal to the data packet length threshold, the data packet is defined as a long data packet; If the length of the received data packet content is less than the data packet length threshold, the data packet is defined as a short data packet.

6. The data transmission method according to claim 5, characterized in that: The combined interface function delivers different types of data packets to the corresponding target client, including: Invoke the packet segmentation model; Inputting the long data packet into a data packet segmentation model to divide the long data packet into a plurality of data segments of equal length; Calling the guide header of the write function to add the guide header to the head of each data segment to obtain multiple guide data segments; Calling the test probe of the write function, creating multiple test probes, adding a guide header to the head of each test probe, obtaining multiple guide test probes, and setting each guide test probe in parallel with each guide data segment; Sending a guidance probe and a guidance data packet in parallel, and determining whether each guidance probe is received; If each section of the guided test probe is received, it is confirmed that the data packet transmission is completed.

7. The data transmission method according to claim 6, characterized in that: Determining the data packet type and setting a suitable interface function based on the data packet type also includes: If not all the guidance probes are received, the missing guidance probes are determined and the corresponding guidance data segments are checked for reception; If the corresponding guided data segment is received, the data packet transmission is confirmed to be complete; If the corresponding navigation data segment is not received, the navigation data segment is retransmitted and inserted into the original position.

8. The data transmission method according to claim 7, characterized in that: Before determining the data packet type and setting a suitable interface function based on the data packet type, the method includes: Creating a data packet segmentation model and setting segmentation rules; the data packet segmentation model is set at the transport layer; Acquire multiple training data packets, and divide each training data packet into multiple data segments according to a set segmentation rule; divide each training data packet into multiple data segments according to the set segmentation rule as verification data segments; Divide multiple training data packets into training sets and test sets; Input the training data packets in the training set into the data packet segmentation model in sequence to train the data packet segmentation model, and the data packet segmentation model outputs a plurality of data segments divided from each training data packet; and the plurality of data segments divided from each training data packet output by the data packet segmentation model are recorded as actual data segments; Determine whether the actual data segment is the same as the verification data segment; If the actual data segment is the same as the verification data segment, the data packet segmentation model training is considered complete, and the trained data packet segmentation model is obtained; If the actual data segment is different from the verification data segment, return to obtain multiple training data packets until the actual data segment is the same as the verification data segment, and obtain the trained data packet segmentation model.

9. The data transmission method according to claim 8, characterized in that: The data transmission method further includes: Calculate the total length of all received data segments; Determine whether the total length of all received data segments is equal to the length of the data packet; If the total length of all received data segments is equal to the length of the data packet, the data transmission is defined as completed; If the total length of all received data segments is not equal to the length of the data packet, the data transmission is defined as failed.

10. A data transmission system, characterized in that: The data transmission system comprises: Sending end; Receiver; The server, the sending end and the receiving end are both connected to the server for communication, the server receives the data packet sent by the sending end, and executes the data transmission method as described in claims 1 to claim 9 on the data packet to send the data packet to the receiving end.