Data transmission method, system and electronic device based on UDP transmission protocol
By segmenting and reassembling data packets using a UDP-based transport protocol, the problems of high connection overhead and low reliability of TCP in industrial networks are solved, achieving efficient and accurate data retransmission, which is suitable for industrial control networks.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- STATE NUCLEAR POWER AUTOMATION SYST ENGCO
- Filing Date
- 2025-12-22
- Publication Date
- 2026-05-29
AI Technical Summary
In existing technologies, the Transmission Control Protocol (TCP) suffers from high connection overhead, low protocol reliability, and inability to achieve efficient and accurate retransmission, which particularly affects the efficiency and reliability of data transmission in industrial control networks.
Using a UDP-based transport protocol, application layer data packets are segmented and a protocol header is added. The packets are then transmitted to the receiving end via UDP and reassembled at the receiving end. If a segment is lost, a retransmission request frame is sent. The sending end performs accurate retransmission and confirms successful reassembly via an acknowledgment response frame.
It avoids the drawback of high connection overhead, improves protocol reliability, and achieves efficient and accurate retransmission, making it suitable for efficient data transmission in industrial networks.
Smart Images

Figure CN122120358A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of industrial network communication technology, and in particular to a data transmission method, system and electronic device based on the UDP transmission protocol. Background Technology
[0002] Industrial control networks are the nervous system of critical infrastructure such as modern manufacturing and power, requiring high-speed and reliable data transmission between devices within the system.
[0003] In existing technologies, Transmission Control Protocol (TCP) can provide reliable, connection-oriented, and in-order byte stream services, but it requires a three-way handshake to establish a connection and a four-way handshake to terminate the connection, resulting in significant connection overhead. Furthermore, the continuous ACK feedback from TCP generates a large number of tiny packets that compete for bandwidth with critical data.
[0004] The data transmission method cannot maintain low overhead and connectionless characteristics. When retransmitting, it usually performs a global retransmission, which cannot achieve efficient and accurate retransmission. Summary of the Invention
[0005] The technical problem to be solved by this disclosure is to overcome the shortcomings of existing data transmission methods, such as high connection overhead, low protocol reliability, and inability to achieve efficient and accurate retransmission, and to provide a data transmission method, system, and electronic device based on the UDP transmission protocol.
[0006] This disclosure solves the above-mentioned technical problems through the following technical solution:
[0007] The first aspect of this disclosure provides a data transmission method based on the UDP transport protocol, the data transmission method comprising:
[0008] The sending end segments the application layer data packets to be transmitted to obtain data segments; a protocol header is added to the data segments, and the data segments with the added protocol header are sent to the receiving end via the UDP transport protocol;
[0009] The receiving end reassembles the data segments according to the information in the protocol header, and sends a retransmission request frame to the sending end when it detects that a reassembled data segment is lost.
[0010] The sending end receives the retransmission request frame, parses the lost data segment from the bitmap in the segment offset field of the retransmission request frame, and retransmits the lost data segment to the receiving end.
[0011] After the receiving end successfully reassembles the complete application layer data packet, it sends an acknowledgment response frame to the sending end.
[0012] Preferably, the data transmission method further includes:
[0013] When it is detected that no data segments are lost after reassembly, an acknowledgment response frame is sent to the sending end;
[0014] And / or,
[0015] The data transmission method further includes:
[0016] The data after adding the protocol header is segmented and stored in the local cache;
[0017] And / or,
[0018] The data transmission method further includes:
[0019] After receiving the acknowledgment response frame, the sending end releases the transmission resources for this round and marks the success of this round of transmission.
[0020] Preferably, the data transmission method further includes:
[0021] The receiving end finds the corresponding reassembled data segments based on the source address and protocol header;
[0022] The sequence number of the data segment is obtained based on the recombined data segment;
[0023] Parse the sequence number and query the bitmap of the received data segments after adding the protocol header;
[0024] In response to the determination based on the bitmap that the data segment after adding the protocol header is a duplicate segment, the new data segment overwrites the old data segment;
[0025] or,
[0026] In response to determining, based on the bitmap, that the data segment after adding the protocol header is a non-repeating segment, the data segment after adding the protocol header is stored in the target offset position in the local cache, and the bitmap is updated.
[0027] Preferably, the data transmission method further includes:
[0028] In response to the detection by the receiving end that the locally cached buffer has not received the end segment, the state of the buffer is set to a waiting state;
[0029] or,
[0030] In response to the detection by the receiving end that the local buffer has received the end segment and that the bitmap of the received end segment has no holes, the state of the buffer is set to the ready state.
[0031] or,
[0032] In response to the receiver detecting that the local cache buffer has received the end segment and that the bitmap of the received end segment has a hole, the state of the buffer is set to an abnormal state.
[0033] Preferably, the step of receiving the retransmission request frame at the sending end, parsing the lost data segment from the bitmap in the segment offset field of the retransmission request frame, and retransmitting the lost data segment to the receiving end includes:
[0034] The sending end receives the retransmission request frame, parses the bitmap in the segment offset field of the retransmission request frame to obtain the offset list of lost segments, retrieves the lost data segments from the local cache according to the offset list, and retransmits the lost data segments to the receiving end.
[0035] Preferably, the steps of segmenting the application layer data packet to be transmitted at the sending end to obtain data segments, adding protocol headers to the data segments, and sending the data segments with added protocol headers to the receiving end via the UDP transport protocol include:
[0036] The sending end divides the application layer data packet into multiple segments according to the preset segment size, resulting in multiple data segments. A protocol header is added to each data segment, and the data segment with the added protocol header is sent to the receiving end via the UDP transport protocol.
[0037] And / or,
[0038] The protocol header includes at least one of the following: protocol header identifier, protocol identifier, frame type, segment length, segment offset, total number of segments, and reserved fields.
[0039] A second aspect of this disclosure provides a data transmission system based on the UDP transport protocol, the data transmission system comprising:
[0040] The segmentation module is used to segment the application layer data packets to be transmitted at the sending end to obtain data segments; add protocol headers to the data segments; and send the data segments with added protocol headers to the receiving end via the UDP transport protocol.
[0041] The reassembly module is used to reassemble the data segments by the receiving end according to the information in the protocol header, and to send a retransmission request frame to the sending end when it detects that a reassembled data segment is lost.
[0042] The first parsing module is used to receive the retransmission request frame from the sending end, parse the lost data segment according to the bitmap in the segment offset field of the retransmission request frame, and retransmit the lost data segment to the receiving end.
[0043] The sending module is used to send an acknowledgment response frame to the sending end in response to the receiving end successfully reassembling the complete application layer data packet.
[0044] Preferably, the data transmission system further includes:
[0045] The first detection module is used to send an acknowledgment response frame to the sending end when it is detected that no data segments after reassembly are lost.
[0046] And / or,
[0047] The data transmission system also includes:
[0048] The storage module is used to segment and store the data after adding the protocol header into a local cache;
[0049] And / or,
[0050] The data transmission system also includes:
[0051] The release module is used to release the transmission resources of the current round and mark the current round of transmission as successful after the sending end receives the acknowledgment response frame.
[0052] Preferably, the data transmission system further includes:
[0053] The lookup module is used by the receiving end to locate the corresponding reassembled data segment based on the source address and protocol header;
[0054] The acquisition module is used to obtain the sequence number of the data segment based on the recombined data segment;
[0055] The second parsing module is used to parse the sequence number and query the bitmap of the received data segments after adding the protocol header;
[0056] The overlay module is used to overwrite the old data segment with the new data segment in response to the determination based on the bitmap that the data segment after adding the protocol header is a duplicate segment;
[0057] or,
[0058] The update module is used to respond to the determination based on the bitmap that the data segment after adding the protocol header is a non-repeating segment, store the data segment after adding the protocol header in the target offset position in the local cache, and update the bitmap.
[0059] Preferably, the data transmission system further includes:
[0060] The second detection module is used to set the state of the buffer to a waiting state in response to the detection by the receiving end that the locally cached buffer has not received the end segment.
[0061] or,
[0062] The third detection module is used to set the state of the buffer to ready state in response to the detection by the receiving end that the local cache buffer has received the end segment and that the bitmap of the received end segment has no holes.
[0063] or,
[0064] The fourth detection module is used to set the state of the buffer to an abnormal state in response to the detection by the receiving end that the local cache buffer has received the end segment and that the bitmap of the received end segment has a hole.
[0065] Preferably, the first parsing module is configured to receive the retransmission request frame from the sending end, parse out the offset list of lost segments according to the bitmap in the segment offset field of the retransmission request frame, obtain the lost data segments from the local cache according to the offset list, and retransmit the lost data segments to the receiving end.
[0066] Preferably, the segmentation processing module is used to divide the application layer data packet into multiple segments according to a preset segment size by the sending end, to obtain multiple data segments, to add a protocol header to each data segment, and to send the data segment with the added protocol header to the receiving end through the UDP transport protocol.
[0067] And / or,
[0068] The protocol header includes at least one of the following: protocol header identifier, protocol identifier, frame type, segment length, segment offset, total number of segments, and reserved fields.
[0069] A third aspect of this disclosure provides an electronic device including a memory, a processor, and a computer program stored in the memory and for running on the processor, wherein the processor executes the computer program to implement the data transmission method based on the UDP transport protocol described in the first aspect.
[0070] The fourth aspect of this disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the data transmission method based on the UDP transport protocol described in the first aspect.
[0071] The fifth aspect of this disclosure provides a computer program product, including a computer program that, when executed by a processor, implements a data transmission method based on the UDP transport protocol as described in the first aspect.
[0072] Based on common knowledge in the field, the above-mentioned preferred conditions can be combined arbitrarily to obtain various preferred embodiments of this disclosure.
[0073] The positive and progressive effects of this disclosure are as follows:
[0074] This disclosure involves the sending end segmenting application layer data packets and sending them to the receiving end via the UDP transport protocol. The receiving end reassembles the data segments. When a lost segment is detected in the reassembled data packet, a retransmission request frame is sent to the sending end. The sending end then performs accurate retransmission. After the receiving end successfully reassembles the complete application layer data packet, it sends an acknowledgment response frame to the sending end. This avoids the drawback of high connection overhead, improves protocol reliability, and achieves efficient and accurate retransmission. Attached Figure Description
[0075] Figure 1 A flowchart illustrating the data transmission method based on the UDP transport protocol provided in Embodiment 1 of this disclosure;
[0076] Figure 2 This is a schematic diagram of a data transmission system based on the UDP transmission protocol provided in Embodiment 2 of this disclosure.
[0077] Figure 3 This is a schematic diagram of the structure of an electronic device that implements the data transmission method based on the UDP transmission protocol according to Embodiment 3 of this disclosure. Detailed Implementation
[0078] The present disclosure is further illustrated below by way of embodiments, but the present disclosure is not limited to the scope of the embodiments described herein.
[0079] The prefixes such as "first" and "second" used in this disclosure are merely for distinguishing different descriptive objects and do not limit the position, order, priority, quantity, or content of the described objects. The use of ordinal numbers and other prefixes used to distinguish descriptive objects in this disclosure does not constitute a limitation on the described objects. The description of the described objects is given in the claims or the context of the embodiments, and should not be construed as an unnecessary limitation. Furthermore, in the description of this embodiment, unless otherwise stated, "multiple" means two or more.
[0080] In this embodiment of the disclosure, the collection, storage, use, processing, transmission, provision, and disclosure of user personal information comply with relevant laws and regulations and do not violate public order and good morals.
[0081] Example 1
[0082] Figure 1 A flowchart of a data transmission method based on the UDP transport protocol provided in Embodiment 1 of this disclosure is shown below. Figure 1 As shown, the data transmission method includes:
[0083] S1. The sending end segments the application layer data packet to be transmitted to obtain data segments; a protocol header is added to the data segments, and the data segments with the added protocol header are sent to the receiving end through the UDP transport protocol;
[0084] In this embodiment, the sending end is responsible for converting application layer data packets into a series of segmentable UDP datagrams (i.e., segmented data), adding a protocol header to each data segment, and sending all the data segments with added protocol headers to the receiving end through a UDP socket. The sending end also performs intelligent retransmission and status maintenance based on the feedback from the receiving end.
[0085] S2. The receiving end reassembles the data segments according to the information in the protocol header, and sends a retransmission request frame to the sending end when it detects that a reassembled data segment is lost.
[0086] S3. Receive a retransmission request frame from the sending end, parse the lost data segment from the bitmap in the segment offset field of the retransmission request frame, and retransmit the lost data segment to the receiving end.
[0087] In this embodiment, the segment offset field of the retransmission request frame uses bitmap encoding to indicate one or more lost segments. For example, one or more bits in the segment offset field of the retransmission request frame are 1 to identify the location of one or more lost segments that need to be retransmitted.
[0088] S4. In response to the successful reassembly of the complete application layer data packet by the receiving end, an acknowledgment response frame is sent to the sending end.
[0089] In this embodiment, after the receiving end successfully reassembles the complete application layer data packet, it sends a final acknowledgment response frame to the sending end.
[0090] In this embodiment, the sending end segments the application layer data packet and sends it to the receiving end via the UDP transport protocol. The receiving end reassembles the data segments. When a missing segment is detected in the reassembled data packet, a retransmission request frame is sent to the sending end. The sending end performs accurate retransmission. After the receiving end successfully reassembles the complete application layer data packet, it sends an acknowledgment response frame to the sending end. This avoids the drawback of high connection overhead, improves protocol reliability, and achieves efficient and accurate retransmission.
[0091] In an optional embodiment, the data transmission method further includes:
[0092] Once it is detected that no data segments have been lost after reassembly, an acknowledgment response frame is sent to the sender.
[0093] In an optional embodiment, the data transmission method further includes:
[0094] The data after adding the protocol header is segmented and stored in the local cache;
[0095] In this embodiment, after sending the data segment with the added protocol header, the sending end caches all the sent data segments locally.
[0096] In an optional embodiment, the data transmission method further includes:
[0097] After receiving the acknowledgment response frame, the sending end releases the transmission resources for this round and marks the success of this round of transmission.
[0098] In this embodiment, after receiving the final cumulative acknowledgment response frame from the receiving end, all transmission resources occupied by this round of transmission are released, indicating that this transmission was successful.
[0099] In an optional embodiment, the data transmission method further includes:
[0100] The receiving end finds the corresponding reassembled data segments based on the source address and protocol header;
[0101] Obtain the sequence number of the data segment based on the recombined data segments;
[0102] Parse the sequence number and query the bitmap of the received data segments after adding the protocol header;
[0103] In response to the determination based on the bitmap that the data segment after adding the protocol header is a duplicate segment, the new data segment will overwrite the old data segment.
[0104] or,
[0105] In response to the determination based on the bitmap that the data segment after adding the protocol header is a non-repeating segment, the data segment after adding the protocol header is stored in the target offset position in the local cache, and the bitmap is updated.
[0106] In this embodiment, if it is determined that the data segment after adding the protocol header is a non-repeating segment, the segmented data is stored in the corresponding offset position in the local cache, and the corresponding bit in the bitmap of the received data segment is marked as valid.
[0107] Furthermore, after receiving the segment identified as the last one, the receiving end checks the bitmap of the received data segments; if the bitmap shows that a segment is lost, the status of the reassembled data segment is set to abnormal; if the bitmap shows that all data segments have been received, the status of the reassembled data segment is set to ready.
[0108] In an optional embodiment, the data transmission method further includes:
[0109] In response to the receiver detecting that the local buffer has not received the end segment, the buffer's state is set to a waiting state;
[0110] or,
[0111] In response to the detection by the receiving end that the local buffer has received the end segment and that the bitmap of the received end segment has no holes, the state of the buffer is set to the ready state.
[0112] or,
[0113] In response to the receiver detecting that the local buffer has received the end segment and that the bitmap of the received end segment has a hole, the buffer's state is set to an abnormal state.
[0114] In this embodiment, after the server starts, it initializes a segment reassembly buffer (e.g., a locally cached buffer) to manage multiple concurrent connections. Each buffer contains a receive state machine, a reassembled data area, a received segment bitmap, and metadata (such as source endpoint identifier, total number of segments, etc.). The server binds to and listens on a specified UDP port and enters a datagram receiving loop. Specifically, the receive state machine records the current state of the session; the reassembled data area caches arriving data segments; and the received segment bitmap records which segments have been successfully received.
[0115] Furthermore, the receiving end reads the incoming data segment from the UDP socket, and finds the corresponding client's reassembled data segment in the local cache buffer according to the source address (IP, Port). If not found, an idle buffer is used.
[0116] Furthermore, the local cache buffers are traversed and checked. If the buffer's state is in a waiting state, no processing is performed. If the buffer's state is in an abnormal state, the receiver generates a retransmission request frame based on the bitmap of the received data segments recorded in the buffer. The segment offset field in the retransmission request frame contains a lost segment bitmap, which precisely indicates which segments are lost and need to be retransmitted by the sender. The receiver sends the retransmission request frame to the sender, implementing receiver-driven selective retransmission. If the buffer's state is in a ready state, after the receiver determines that all data segments of the entire application layer data packet have been successfully received through continuous reception and reassembly, it executes the processing flow corresponding to the retransmission request frame, sends a final cumulative acknowledgment response frame to the sender, and releases the corresponding transmission resources.
[0117] In an optional embodiment, S3 includes:
[0118] The receiving end receives a retransmission request frame and parses the bitmap in the segment offset field of the retransmission request frame to obtain the offset list of lost segments. Based on the offset list, it retrieves the lost data segments from the local cache and retransmits the lost data segments to the receiving end.
[0119] In this embodiment, after receiving a retransmission request frame, the sending end parses the offset list of lost segments according to the bitmap represented by the segment offset field, and immediately retrieves the corresponding data segments from the local cache for retransmission, thus realizing selective retransmission.
[0120] In an optional embodiment, S1 includes:
[0121] The sending end divides the application layer data packet into multiple segments according to the preset segment size, resulting in multiple data segments. A protocol header is added to each data segment, and the data segment with the added protocol header is sent to the receiving end via the UDP transport protocol.
[0122] In this embodiment, the sending end receives the Protocol Data Unit (PDU) to be transmitted (it should be noted that the Protocol Data Unit contains the data packets that the application layer needs to send), and divides the application layer data packets into multiple segments according to the predefined segment size (MTU - header overhead) to ensure efficient transmission and avoid IP layer fragmentation.
[0123] In an optional embodiment, the protocol header includes at least one of the following: protocol header identifier, protocol identifier, frame type, segment length, segment offset, total number of segments, and reserved fields.
[0124] In this embodiment, the protocol header identifier is used to identify the start of the protocol header; the protocol identifier is used to identify this protocol; the segment length is used to indicate the length of the current segment; the total number of segments is used to indicate the total number of segments into which the complete application layer data packet is divided; the frame type is used to identify whether the current frame is a request frame (REQ) / response frame (RESP) / retransmission request frame (RPREQ); the segment offset is used to represent the segment offset using bitmap encoding. This bitmap is a binary sequence, and each valid bit (a bit with a value of 1) in the bitmap represents an offset value. For request frames and response frames, there is exactly one valid bit, which identifies the specific position of the current segment in the complete frame. For retransmission request frames, there may be multiple valid bits, which identify the position of segments that have been lost and need to be retransmitted; and the reserved field is used to reserve extension fields.
[0125] In this embodiment, the sending end segments large data packets and sends them via the UDP transport protocol; the receiving end buffers out-of-order segments and proactively sends retransmission request frames by detecting sequence number gaps to retransmit the specified lost data segments; the sending end performs precise retransmission; after successfully reassembling the complete data, the receiving end sends a final cumulative acknowledgment response frame to the sending end only once. This overcomes the shortcomings of TCP protocol in industrial control and other scenarios, such as high connection overhead and high acknowledgment traffic, and achieves high reliability, low latency, and high concurrency large data transmission capabilities under connectionless and low-overhead conditions. It is particularly suitable for industrial network environments with high requirements for deterministic latency and reliability. Furthermore, this embodiment minimizes the number of response frames through a final cumulative acknowledgment mechanism, dedicating almost all bandwidth to effective data transmission and improving bandwidth utilization; it enhances retransmission response speed and reduces transmission latency through connectionless establishment delay; selective retransmission based on retransmission request frames only retransmits lost data segments, avoiding bandwidth waste and achieving precise and efficient retransmission while avoiding global retransmission; it effectively handles network out-of-order delivery through receiver buffers and sorting algorithms, ensuring data correctness and enhancing anti-out-of-order delivery capabilities; and its pure application-layer implementation requires no modification to the operating system kernel or network devices, ensuring compatibility with existing network infrastructure, simplifying deployment, and enhancing compatibility.
[0126] It should be noted that this embodiment supports a lightweight reliable transmission protocol that supports large data packet segmentation, out-of-order reassembly, selective retransmission, and final cumulative acknowledgment. It is suitable for application scenarios that are sensitive to latency, have high concurrency, and require high-speed transmission of large amounts of data.
[0127] Example 2
[0128] Corresponding to the aforementioned embodiment of a data transmission method based on the UDP transmission protocol, this disclosure also provides an embodiment of a data transmission system based on the UDP transmission protocol.
[0129] Figure 2 This is a schematic diagram of a data transmission system based on the UDP transport protocol provided in Embodiment 2 of this disclosure, as shown below. Figure 2 As shown, the data transmission system includes:
[0130] The segmentation processing module 21 is used to segment the application layer data packets to be transmitted through the sending end to obtain data segments; add protocol headers to the data segments; and send the data segments with added protocol headers to the receiving end through the UDP transport protocol.
[0131] In this embodiment, the sending end is responsible for converting application layer data packets into a series of segmentable UDP datagrams (i.e., segmented data), adding a protocol header to each data segment, and sending all the data segments with added protocol headers to the receiving end through a UDP socket. The sending end also performs intelligent retransmission and status maintenance based on the feedback from the receiving end.
[0132] The reassembly module 22 is used to reassemble the data segments by the receiving end according to the information in the protocol header, and to send a retransmission request frame to the sending end when it detects that a reassembled data segment is lost.
[0133] The first parsing module 23 is used to receive a retransmission request frame from the sending end, parse out the lost data segment according to the bitmap in the segment offset field of the retransmission request frame, and retransmit the lost data segment to the receiving end.
[0134] In this embodiment, the segment offset field of the retransmission request frame uses bitmap encoding to indicate one or more lost segments. For example, one or more bits in the segment offset field of the retransmission request frame are 1 to identify the location of one or more lost segments that need to be retransmitted.
[0135] The sending module 24 is used to send an acknowledgment response frame to the sending end in response to the receiving end successfully reassembling the complete application layer data packet.
[0136] In this embodiment, after the receiving end successfully reassembles the complete application layer data packet, it sends a final acknowledgment response frame to the sending end.
[0137] In an optional embodiment, the data transmission system further includes:
[0138] The first detection module is used to send an acknowledgment response frame to the sending end when it is detected that no data segments have been lost after reassembly.
[0139] In an optional embodiment, the data transmission system further includes:
[0140] The storage module is used to segment and store the data after adding the protocol header into a local cache;
[0141] In this embodiment, after sending the data segment with the added protocol header, the sending end caches all the sent data segments locally.
[0142] In an optional embodiment, the data transmission system further includes:
[0143] The release module is used to release the transmission resources of the current round and mark the current round of transmission as successful after the sending end receives the acknowledgment response frame.
[0144] In this embodiment, after receiving the final cumulative acknowledgment response frame from the receiving end, all transmission resources occupied by this round of transmission are released, indicating that this transmission was successful.
[0145] In an optional embodiment, the data transmission system further includes:
[0146] The lookup module is used by the receiving end to locate the corresponding reassembled data segment based on the source address and protocol header;
[0147] The acquisition module is used to obtain the sequence number of the data segment based on the recombined data segments;
[0148] The second parsing module is used to parse the sequence number and query the bitmap of the received data segments after adding the protocol header;
[0149] The overlay module is used to overwrite the old data segment with the new data segment when the data segment after adding the protocol header is determined to be a duplicate segment based on the bitmap.
[0150] or,
[0151] The update module is used to respond to the determination that the data segment after adding the protocol header is a non-repeating segment based on the bitmap, store the data segment after adding the protocol header to the target offset position in the local cache, and update the bitmap.
[0152] In this embodiment, if it is determined that the data segment after adding the protocol header is a non-repeating segment, the segmented data is stored in the corresponding offset position in the local cache, and the corresponding bit in the bitmap of the received data segment is marked as valid.
[0153] Furthermore, after receiving the segment identified as the last one, the receiving end checks the bitmap of the received data segments; if the bitmap shows that a segment is lost, the status of the reassembled data segment is set to abnormal; if the bitmap shows that all data segments have been received, the status of the reassembled data segment is set to ready.
[0154] In an optional embodiment, the data transmission system further includes:
[0155] The second detection module is used to set the buffer state to a waiting state in response to the detection by the receiving end that the local buffer has not received the end segment.
[0156] or,
[0157] The third detection module is used to set the state of the buffer to ready state in response to the detection by the receiving end that the local buffer has received the end segment and that the bitmap of the received end segment has no holes.
[0158] or,
[0159] The fourth detection module is used to set the buffer state to an abnormal state in response to the detection by the receiving end that the local buffer has received the end segment and that the bitmap of the received end segment has a hole.
[0160] In this embodiment, after the server starts, it initializes a segment reassembly buffer (e.g., a locally cached buffer) to manage multiple concurrent connections. Each buffer contains a receive state machine, a reassembled data area, a received segment bitmap, and metadata (such as source endpoint identifier, total number of segments, etc.). The server binds to and listens on a specified UDP port and enters a datagram receiving loop. Specifically, the receive state machine records the current state of the session; the reassembled data area caches arriving data segments; and the received segment bitmap records which segments have been successfully received.
[0161] Furthermore, the receiving end reads the incoming data segment from the UDP socket, and finds the corresponding client's reassembled data segment in the local cache buffer according to the source address (IP, Port). If not found, an idle buffer is used.
[0162] Furthermore, the local cache buffers are traversed and checked. If the buffer's state is in a waiting state, no processing is performed. If the buffer's state is in an abnormal state, the receiver generates a retransmission request frame based on the bitmap of the received data segments recorded in the buffer. The segment offset field in the retransmission request frame contains a lost segment bitmap, which precisely indicates which segments are lost and need to be retransmitted by the sender. The receiver sends the retransmission request frame to the sender, implementing receiver-driven selective retransmission. If the buffer's state is in a ready state, after the receiver determines that all data segments of the entire application layer data packet have been successfully received through continuous reception and reassembly, it executes the processing flow corresponding to the retransmission request frame, sends a final cumulative acknowledgment response frame to the sender, and releases the corresponding transmission resources.
[0163] In an optional embodiment, the first parsing module is configured to receive a retransmission request frame from the sending end, parse out the offset list of lost segments according to the bitmap in the segment offset field of the retransmission request frame, retrieve the lost data segments from the local cache according to the offset list, and retransmit the lost data segments to the receiving end.
[0164] In this embodiment, after receiving a retransmission request frame, the sending end parses the offset list of lost segments according to the bitmap represented by the segment offset field, and immediately retrieves the corresponding data segments from the local cache for retransmission, thus realizing selective retransmission.
[0165] In an optional embodiment, the segmentation processing module is used to divide the application layer data packet into multiple segments according to a preset segment size by the sending end, to obtain multiple data segments, to add a protocol header to each data segment, and to send the data segment with the added protocol header to the receiving end through the UDP transport protocol.
[0166] In this embodiment, the sending end receives the Protocol Data Unit (PDU) to be transmitted (it should be noted that the Protocol Data Unit contains the data packets that the application layer needs to send), and divides the application layer data packets into multiple segments according to the predefined segment size (MTU - header overhead) to ensure efficient transmission and avoid IP layer fragmentation.
[0167] In an optional embodiment, the protocol header includes at least one of the following: protocol header identifier, protocol identifier, frame type, segment length, segment offset, total number of segments, and reserved fields.
[0168] In this embodiment, the protocol header identifier is used to identify the start of the protocol header; the protocol identifier is used to identify this protocol; the segment length is used to indicate the length of the current segment; the total number of segments is used to indicate the total number of segments into which the complete application layer data packet is divided; the frame type is used to identify whether the current frame is a request frame (REQ) / response frame (RESP) / retransmission request frame (RPREQ); the segment offset is used to represent the segment offset using bitmap encoding. This bitmap is a binary sequence, and each valid bit (a bit with a value of 1) in the bitmap represents an offset value. For request frames and response frames, there is exactly one valid bit, which identifies the specific position of the current segment in the complete frame. For retransmission request frames, there may be multiple valid bits, which identify the position of segments that have been lost and need to be retransmitted; and the reserved field is used to reserve extension fields.
[0169] In this embodiment, the sending end segments large data packets and sends them via the UDP transport protocol; the receiving end buffers out-of-order segments and proactively sends retransmission request frames by detecting sequence number gaps to retransmit the specified lost data segments; the sending end performs precise retransmission; after successfully reassembling the complete data, the receiving end sends a final cumulative acknowledgment response frame to the sending end only once. This overcomes the shortcomings of TCP protocol in industrial control and other scenarios, such as high connection overhead and high acknowledgment traffic, and achieves high reliability, low latency, and high concurrency large data transmission capabilities under connectionless and low-overhead conditions. It is particularly suitable for industrial network environments with high requirements for deterministic latency and reliability. Furthermore, this embodiment minimizes the number of response frames through a final cumulative acknowledgment mechanism, dedicating almost all bandwidth to effective data transmission and improving bandwidth utilization; it enhances retransmission response speed and reduces transmission latency through connectionless establishment delay; selective retransmission based on retransmission request frames only retransmits lost data segments, avoiding bandwidth waste and achieving precise and efficient retransmission while avoiding global retransmission; it effectively handles network out-of-order delivery through receiver buffers and sorting algorithms, ensuring data correctness and enhancing anti-out-of-order delivery capabilities; and its pure application-layer implementation requires no modification to the operating system kernel or network devices, ensuring compatibility with existing network infrastructure, simplifying deployment, and enhancing compatibility.
[0170] It should be noted that this embodiment supports a lightweight reliable transmission protocol that supports large data packet segmentation, out-of-order reassembly, selective retransmission, and final cumulative acknowledgment. It is suitable for application scenarios that are sensitive to latency, have high concurrency, and require high-speed transmission of large amounts of data.
[0171] For the system embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this disclosure according to actual needs.
[0172] Example 3
[0173] Figure 3 This is a schematic diagram of the structure of an electronic device according to Embodiment 3 of this disclosure. The electronic device includes a memory, a processor, and a computer program stored in the memory and used to run on the processor. When the processor executes the computer program, it implements the data transmission method based on the UDP transmission protocol described in any of the above embodiments. Figure 3 The electronic device 90 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.
[0174] like Figure 3 As shown, the electronic device 90 can be manifested as a general-purpose computing device, such as a server device. The components of the electronic device 90 may include, but are not limited to: at least one processor 91, at least one memory 92, and a bus 93 connecting different system components (including memory 92 and processor 91).
[0175] Bus 93 includes a data bus, an address bus, and a control bus.
[0176] The memory 92 may include volatile memory, such as random access memory (RAM) 921 and / or cache memory 922, and may further include read-only memory (ROM) 923.
[0177] The memory 92 may also include a program tool 925 (or utility) having a set (at least one) program module 924, such program module 924 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.
[0178] The processor 91 executes various functional applications and data processing by running computer programs stored in the memory 92, such as the data transmission method based on the UDP transport protocol provided in any of the above embodiments.
[0179] Electronic device 90 can also communicate with one or more external devices 94 (e.g., keyboard, pointing device, etc.). This communication can be performed via input / output (I / O) interface 95. Furthermore, electronic device 90 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 96. Figure 3 As shown, network adapter 96 communicates with other modules of electronic device 90 via bus 93. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with electronic device 90, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems.
[0180] It should be noted that although several units / modules or sub-units / modules of the electronic device have been mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided and embodied by multiple units / modules.
[0181] Example 4
[0182] Embodiment 4 of this disclosure also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the data transmission method based on the UDP transmission protocol provided in any of the above embodiments.
[0183] The readable storage medium may be more specifically adopted, including but not limited to: portable disk, hard disk, random access memory, read-only memory, erasable programmable read-only memory, optical storage device, magnetic storage device, or any suitable combination thereof.
[0184] Example 5
[0185] Embodiment 5 of this disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the data transmission method based on the UDP transport protocol described in any of the preceding claims.
[0186] The program code for executing the computer program product of this disclosure can be written in any combination of one or more programming languages, and the program code can be executed entirely on a user device, partially on a user device, as a stand-alone software package, partially on a user device and partially on a remote device, or entirely on a remote device.
[0187] While specific embodiments of this disclosure have been described above, those skilled in the art should understand that these are merely illustrative examples, and the scope of protection of this disclosure is defined by the appended claims. Those skilled in the art can make various changes or modifications to these embodiments without departing from the principles and essence of this disclosure, but all such changes and modifications fall within the scope of protection of this disclosure.
Claims
1. A data transmission method based on the UDP transport protocol, characterized in that, The data transmission method includes: The sending end segments the application layer data packets to be transmitted to obtain data segments; a protocol header is added to the data segments, and the data segments with the added protocol header are sent to the receiving end via the UDP transport protocol; The receiving end reassembles the data segments according to the information in the protocol header, and sends a retransmission request frame to the sending end when it detects that a reassembled data segment is lost. The sending end receives the retransmission request frame, parses the lost data segment from the bitmap in the segment offset field of the retransmission request frame, and retransmits the lost data segment to the receiving end. After the receiving end successfully reassembles the complete application layer data packet, it sends an acknowledgment response frame to the sending end.
2. The data transmission method based on the UDP transmission protocol as described in claim 1, characterized in that, The data transmission method further includes: When it is detected that no data segments are lost after reassembly, an acknowledgment response frame is sent to the sending end; And / or, The data transmission method further includes: The data after adding the protocol header is segmented and stored in the local cache; And / or, The data transmission method further includes: After receiving the acknowledgment response frame, the sending end releases the transmission resources for this round and marks the success of this round of transmission.
3. The data transmission method based on the UDP transmission protocol as described in claim 1, characterized in that, The data transmission method further includes: The receiving end finds the corresponding reassembled data segments based on the source address and protocol header; The sequence number of the data segment is obtained based on the recombined data segment; Parse the sequence number and query the bitmap of the received data segments after adding the protocol header; In response to the determination based on the bitmap that the data segment after adding the protocol header is a duplicate segment, the new data segment overwrites the old data segment; or, In response to determining from the bitmap that the data segment after adding the protocol header is a non-repeating segment, the data segment after adding the protocol header is stored in the target offset position in the local cache, and the bitmap is updated.
4. The data transmission method based on the UDP transmission protocol as described in claim 1, characterized in that, The data transmission method further includes: In response to the detection by the receiving end that the locally cached buffer has not received the end segment, the state of the buffer is set to a waiting state; or, In response to the detection by the receiving end that the local buffer has received the end segment and that the bitmap of the received end segment has no holes, the state of the buffer is set to the ready state. or, In response to the receiver detecting that the local cache buffer has received the end segment and that the bitmap of the received end segment has a hole, the state of the buffer is set to an abnormal state.
5. The data transmission method based on the UDP transport protocol as described in claim 1, characterized in that, The steps of receiving the retransmission request frame at the sending end, parsing the lost data segments from the bitmap in the segment offset field of the retransmission request frame, and retransmitting the lost data segments to the receiving end include: The sending end receives the retransmission request frame, parses the bitmap in the segment offset field of the retransmission request frame to obtain the offset list of lost segments, retrieves the lost data segments from the local cache according to the offset list, and retransmits the lost data segments to the receiving end.
6. The data transmission method based on the UDP transport protocol as described in claim 1, characterized in that, The process involves segmenting the application layer data packets to be transmitted at the sending end to obtain data segments. The steps of adding protocol headers to the data segments and sending the data segments with added protocol headers to the receiving end via the UDP transport protocol include: The sending end divides the application layer data packet into multiple segments according to the preset segment size, resulting in multiple data segments. A protocol header is added to each data segment, and the data segment with the added protocol header is sent to the receiving end via the UDP transport protocol. And / or, The protocol header includes at least one of the following: protocol header identifier, protocol identifier, frame type, segment length, segment offset, total number of segments, and reserved fields.
7. A data transmission system based on the UDP transport protocol, characterized in that, The data transmission system includes: The segmentation module is used to segment the application layer data packets to be transmitted at the sending end to obtain data segments; add protocol headers to the data segments; and send the data segments with added protocol headers to the receiving end via the UDP transport protocol. The reassembly module is used to reassemble the data segments by the receiving end according to the information in the protocol header, and to send a retransmission request frame to the sending end when it detects that a reassembled data segment is lost. The parsing module is used to receive the retransmission request frame from the sending end, parse the lost data segments according to the bitmap in the segment offset field of the retransmission request frame, and retransmit the lost data segments to the receiving end. The sending module is used to send an acknowledgment response frame to the sending end in response to the receiving end successfully reassembling the complete application layer data packet.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and for running on the processor, characterized in that, When the processor executes the computer program, it implements the data transmission method based on the UDP transmission protocol as described in any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the data transmission method based on the UDP transmission protocol as described in any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the data transmission method based on the UDP transport protocol as described in any one of claims 1 to 6.