UDP (User Datagram Protocol) reliable transmission method and device, equipment and storage medium

By adopting the selective retransmission mode during UDP transmission, the transmitter retransmits part of specific frames according to the reception situation feedback from the receiver, solving the consumption problem of existing UDP reliable transmission methods in scenarios with bandwidth limitations, and achieving efficient UDP Reliable transmission.

CN119519903APending Publication Date: 2025-02-25WUHAN SHIP COMM RES INST (NO 722 RES INST OF CHINA STATE SHIPBUILDING CORP)
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411641997.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-18
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

The existing reliable UDP transmission method consumes a lot in scenarios with bandwidth limitations, resulting in a decrease in communication quality, and the problem of delay and redundant packet increase in requested retransmission and FEC selection retransmission methods.

Method used

The selective retransmission mode is adopted. The transmitter sends a reply frame to retransmit a specific frame according to the reception situation feedback from the receiver, reducing the response frequency, reducing the packet retransmission rate, and realizing reliable UDP transmission in the case of small channel bandwidth.

Benefits of technology

The data packet retransmission rate and communication overhead are reduced, the amount of data that the sender needs to retransmit, the communication quality is greatly reduced, the retransmission delay is shortened, and the computing amount of both parties in the communication is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119519903A_ABST
    Figure CN119519903A_ABST
Patent Text Reader

Abstract

The invention discloses a UDP (User Datagram Protocol) reliable transmission method, which comprises the following steps that: S1, a sending end and a receiving end respectively create a socket SOCKET, the sending end calculates the total frame number of a message, and the receiving end enters a cyclic receiving program; s2, the sending end sends a zeroth frame, the sending end sequentially sends all data frames from the first frame, and the data frame sent finally is a tail frame; s3, the receiving end performs CRC verification on each received frame, and sends the message receiving condition to the sending end through a response frame; s4, the sending end resends all frames which are not received by the receiving end based on the response frame; s5, if the receiving end receives all the messages, sending a response frame to the sending end, and ending the sending and receiving process; and if part of the messages are not received by the receiving end, returning to the step S3. The invention further discloses UDP reliable transmission equipment and a corresponding storage medium. According to the invention, the communication overhead is reduced, the data volume required to be retransmitted by the transmitting end is reduced, the retransmission delay is shortened, and the method is simpler and easier to implement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of network data transmission, and more specifically, to a UDP reliable transmission method, apparatus, device and storage medium. Background Art

[0002] UDP (User Datagram Protocol) is a datagram mode that provides packet switching computer communication in a group of interconnected computer network environments. UDP provides a process for applications to send messages to other programs with minimal protocol mechanisms. The protocol is transaction-oriented and does not guarantee delivery and duplicate protection. Therefore, a retransmission mechanism is required to ensure reliable UDP transmission.

[0003] There are three main modes of existing UDP reliable transmission. The first is timed retransmission. If the sender does not receive the received response frame sent by the receiver within a fixed time after sending a data frame, the sender will retransmit the data frame. This method consumes a lot of bandwidth and is not suitable for use scenarios with limited bandwidth. The second is request retransmission. The receiver determines whether there is packet loss based on the serial number of the received data frame, and retransmits all the data frames starting from the lost data frame. If the network is very bad, the sender will retransmit continuously, causing the communication quality to deteriorate. In addition, the request retransmission method has a large delay and is not suitable for scenarios with small bandwidth. The third is FEC selective retransmission. When the sender sends a message, it will group several messages according to the FEC method, obtain several redundant packets through XOR, and then send them together to the receiver. If the receiver finds that the packet is lost but can be restored through the FEC grouping algorithm, it will not request retransmission from the sender. Otherwise, it will request the original data frame from the sender. Under a transmission condition where the bandwidth is not very sufficient, FEC selective retransmission will increase redundant messages, which may make the network quality worse. Summary of the invention

[0004] In response to at least one defect or improvement need in the prior art, the present invention provides a UDP reliable transmission method, apparatus, device and storage medium, which will solve at least one of the problems existing in the above-mentioned background technology.

[0005] To achieve the above object, according to a first aspect of the present invention, a UDP reliable transmission method is provided, the method comprising:

[0006] S1 The sender and receiver create sockets respectively. The sender calculates the total number of message frames, and the receiver enters a loop receiving program.

[0007] S2 The sending end sends the 0th frame, which is a message information frame including the total message length, the total number of message frames and the message serial number. The sending end sends all data frames in sequence starting from the 1st frame, and the last data frame sent is the tail frame;

[0008] S3 The receiving end performs CRC check on each received frame, discards the message with check error, checks the message reception status based on the message information of the 0th frame after receiving the last frame, and sends the message reception status to the sending end through a response frame;

[0009] S4 The sender resends all frames that the receiver has not received based on the response frame;

[0010] S5: If the receiving end receives all the messages, it sends a response frame to the sending end, ending the current sending and receiving process; if the receiving end fails to receive some messages, it returns to step S3.

[0011] Furthermore, the above-mentioned UDP reliable transmission method, the message reception status is checked based on the message information of the 0th frame, specifically including the receiving end comparing the total message length, total number of message frames and message serial number contained in the message information of the 0th frame with all received messages to confirm whether all messages are received, and if not all messages are received, obtaining the message serial number of the missing message frame.

[0012] Furthermore, in the above UDP reliable transmission method, after the sending end sends the tail frame, if no response frame is received within a preset time interval, an inquiry frame is sent to the receiving end.

[0013] Furthermore, in the above UDP reliable transmission method, if no response frame is received after sending inquiry frames three times, the SOCKET is closed to end the current transmission.

[0014] Furthermore, in the above UDP reliable transmission method, after receiving the 0th frame, the receiving end initializes data reception and enters a cyclic receiving program.

[0015] Furthermore, in the above UDP reliable transmission method, in step S3, after receiving the 0th frame, the receiving end checks whether the 0th frame is received repeatedly. If it is received repeatedly, the 0th frame received later is discarded.

[0016] Furthermore, in the above UDP reliable transmission method, if the receiving end does not receive the 0th frame, the subsequently received data frames will be discarded.

[0017] According to the second aspect of the present invention, a UDP reliable transmission device is also provided, which includes at least one processing unit and at least one storage unit, wherein the storage unit stores a computer program, and when the computer program is executed by the processing unit, the processing unit executes the steps of any one of the above-mentioned methods.

[0018] According to the third aspect of the present invention, a storage medium is also provided, which stores a computer program that can be executed by a UDP reliable transmission device. When the computer program runs on the UDP reliable transmission device, the UDP reliable transmission device executes the steps of any one of the above-mentioned methods.

[0019] According to a fourth aspect of the present invention, there is also provided a computer program product, comprising a computer program, characterized in that when the computer program is executed by a processor, the steps of any one of the above-mentioned UDP reliable transmission methods are implemented.

[0020] In general, the above technical solutions conceived by the present invention can achieve the following beneficial effects compared with the prior art:

[0021] The present invention provides a UDP reliable transmission method. By adopting a selective retransmission mode during UDP transmission, the sending end will retransmit some specific frames according to the reception status response frame fed back by the receiving end, thereby reducing the response frequency sent by the receiving end, reducing the data packet retransmission rate, reducing communication overhead, and reducing the amount of data that the sending end needs to retransmit, which will not cause a significant decrease in communication quality, shorten the retransmission delay, and do not need to generate too many redundant packets. It can reduce the amount of calculation of both communicating parties, is simpler and easier to implement, and realizes UDP reliable transmission when the channel bandwidth is small. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0023] Figure 1 A flow chart of a UDP reliable transmission method provided in an embodiment of the present application;

[0024] Figure 2 A schematic diagram of a UDP reliable transmission method protocol process provided in an embodiment of the present application;

[0025] Figure 3 A UDP reliable transmission method sending end flow chart provided in an embodiment of the present application;

[0026] Figure 4 A flowchart of a UDP reliable transmission method receiving end provided in an embodiment of the present application. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0028] The terms "first", "second", "third", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.

[0029] Figure 1 A flow chart of a UDP reliable transmission method provided in an embodiment of the present application is as follows: Figure 1 As shown, a UDP reliable transmission method provided in an embodiment of the present application includes:

[0030] S1 The sender and receiver create sockets respectively. The sender calculates the total number of message frames, and the receiver enters a loop receiving program.

[0031] S2 The sending end sends the 0th frame, which is a message information frame including the total message length, the total number of message frames and the message serial number. The sending end sends all data frames in sequence starting from the 1st frame, and the last data frame sent is the tail frame;

[0032] S3 The receiving end performs CRC check on each received frame, discards the message with check error, checks the message reception status based on the message information of the 0th frame after receiving the last frame, and sends the message reception status to the sending end through a response frame;

[0033] S4 The sender resends all frames that the receiver has not received based on the response frame;

[0034] S5: If the receiving end receives all the messages, it sends a response frame to the sending end, ending the current sending and receiving process; if the receiving end fails to receive some messages, it returns to step S3.

[0035] Specifically, the UDP reliable transmission method provided in the embodiment of the present application transmits message data in frames according to the protocol length and retransmits lost frames. The protocol process consists of two parts: sending and receiving.

[0036] At the beginning of communication, the sender transmits the message information through the first frame (frame 0), including the entire message length, total number of frames, message serial number, etc. The receiver initializes the receiving state according to the first frame and discards the messages that arrive before frame 0.

[0037] The sending frame divides the message data into frames and sends the tail frame at the end. After the sending is completed, the receiving end determines the acceptance result through the received response frame, and retransmits the unreceived data frame until the receiving end receives the response frame and determines that the receiving end has received all the message information. During the retransmission process, if the response frame is still not received after n retransmissions, the sending is exited and the sending task is ended. The above n times can be determined according to actual work needs. In order to save bandwidth resources, n is usually 3.

[0038] The receiving end receives messages in a loop, combines the message data of the received data frames according to the frame number position, and judges the sending status if the tail frame or inquiry frame is received. The received combined message data is compared with the entire message length, total number of frames, message serial number, etc. contained in the received 0th frame. If the message data is not lost, the corresponding response frame is sent to the sending end. If part of the message data is lost, the response frame containing the corresponding number of message frames that have not been received or the message serial number information is sent to the sending end, waiting for the sending end to retransmit.

[0039] As long as the data frame received by the receiving end of this application is not before the first frame, the receiving end will not restrict the receiving order. For example, if a total of ten frames are sent, except for the first frame and the last frame, the order of the eight frames in the middle is not required. The receiving end will reassemble the frames according to the serial number of the data frame itself. This application can be applied to UDP transmission and the channel bandwidth is small, which can ensure that the communication overhead of the transmission process is small and the implementation is simple.

[0040] The UDP reliable transmission method provided by the embodiment of the present application adopts a selective retransmission mode during the UDP transmission process. The sending end will retransmit some specific frames in the response frame based on the reception status feedback from the receiving end, thereby reducing the response frequency sent by the receiving end, reducing the data packet retransmission rate, reducing communication overhead, and reducing the amount of data that needs to be retransmitted by the sending end without causing a significant decrease in communication quality. The retransmission delay is shortened, and there is no need to generate too many redundant packets. The calculation amount of both communicating parties can be reduced, and it is simpler and easier to implement. UDP reliable transmission can be achieved when the channel bandwidth is small.

[0041] Optionally, the UDP reliable transmission method provided in the embodiment of the present application, wherein the message reception status is checked based on the message information of the 0th frame, specifically including the receiving end comparing the total message length, total number of message frames and message serial number contained in the message information of the 0th frame with all received messages to confirm whether all messages are received, and if not all messages are received, obtaining the message serial number of the missing message frame.

[0042] Optionally, the UDP reliable transmission method provided in the embodiment of the present application sends an inquiry frame to the receiving end if no response frame is received within a preset time interval after the sending end sends the tail frame.

[0043] Optionally, in the UDP reliable transmission method provided in the embodiment of the present application, if no response frame is received after sending inquiry frames three times, the SOCKET is closed to end the current transmission.

[0044] Optionally, in the UDP reliable transmission method provided in the embodiment of the present application, after receiving the 0th frame, the receiving end initializes data reception and enters a cyclic receiving program.

[0045] Optionally, in the UDP reliable transmission method provided by the embodiment of the present application, in step S3, the receiving end checks whether the 0th frame is received repeatedly after receiving the 0th frame. If it is received repeatedly, the 0th frame received later is discarded.

[0046] Optionally, in the UDP reliable transmission method provided in the embodiment of the present application, if the receiving end does not receive the 0th frame, the subsequently received data frames are discarded.

[0047] The following is a specific example of a UDP reliable transmission method provided by the present application. The overall specific execution process is as follows: Figure 2 shown.

[0048] For the sender, Figure 3 As shown, perform the following steps:

[0049] a) Create a socket SOCKET;

[0050] b) Calculate the total number of message frames;

[0051] c) Send the first frame (frame 0), which is the message information frame (including the entire message length, total number of frames, and message serial number);

[0052] d) Send all data frames in sequence starting from frame 1;

[0053] e) Sending is completed and waiting for the response frame from the receiving end;

[0054] f) Wait for the query frame to time out, return to the previous step, and continue to wait for the receiving end to respond. If the query frame is sent three times but still times out without a response, close the SOCKET to end this transmission;

[0055] g) After receiving the response frame, determine whether the receiving end has received all the messages. If all are received, close the SOCKET to end the current transmission. Otherwise, obtain the data frame number that has not been received and resend the corresponding data frame;

[0056] h) Repeat the above steps until all messages arrive at the receiving end, and close the SOCKET to end the transmission.

[0057] For the receiving end, Figure 4 As shown, perform the following steps:

[0058] a) Create a socket SOCKET;

[0059] b) The receiving end waits in a loop to receive a message;

[0060] c) Perform CRC check on the received message. If the check is wrong, discard the message and return to b);

[0061] d) Determine the message type, if it is an inquiry frame, go to e), if it is a data frame, go to f);

[0062] e) Send a response frame based on the received status, and then return to b);

[0063] f) If it is the first frame, perform data reception initialization and return to b), otherwise go to g);

[0064] g) Determine whether the first frame has been received. If it has been received, go to h), otherwise return to b);

[0065] h) Determine whether the frame has been received (i.e., a duplicate frame). If it has been received, discard the frame and return to b). Otherwise, go to i);

[0066] i) receiving and processing message data;

[0067] j) Determine whether the tail frame has been received. If it has been received, go to l), otherwise go to k);

[0068] k) Determine whether it is the last frame, if yes, go to l), otherwise return to b);

[0069] l) Check the reception status. If the reception is not completed, go back to b). If the reception is completed, go to m);

[0070] m) Send a response frame, submit data, recycle resources, and end the receiving process.

[0071] The present application also provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the steps of the above method are implemented. The computer-readable storage medium may include, but is not limited to, any type of disk, including a floppy disk, an optical disk, a DVD, a CD-ROM, a micro drive, and a magneto-optical disk, a ROM, a RAM, an EPROM, an EEPROM, a DRAM, a VRAM, a flash memory device, a magnetic card or an optical card, a nanosystem (including a molecular memory IC), or any type of medium or device suitable for storing instructions and / or data.

[0072] It should be noted that, for the aforementioned 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 present application is not limited by the described order of actions, because according to 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 and modules involved are not necessarily required by the present application.

[0073] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0074] In the several embodiments provided in the present application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

[0075] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0076] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0077] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM), random access memory (RAM), mobile hard disk, disk or optical disk and other media that can store program code.

[0078] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable memory, which can include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0079] The above is only an exemplary embodiment of the present disclosure, and the scope of the present disclosure cannot be limited thereto. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the specification and practicing the disclosure here, those skilled in the art will easily think of the implementation scheme of the present disclosure. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the technical field not recorded in the present disclosure. The description and examples are regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.

[0080] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0081] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A UDP reliable transmission method, characterized in that: include: S1 The sender and receiver create sockets respectively. The sender calculates the total number of message frames, and the receiver enters a loop receiving program. S2 The sending end sends the 0th frame, which is a message information frame including the total message length, the total number of message frames and the message serial number. The sending end sends all data frames in sequence starting from the 1st frame, and the last data frame sent is the tail frame; S3 The receiving end performs CRC check on each received frame, discards the message with check error, checks the message reception status based on the message information of the 0th frame after receiving the last frame, and sends the message reception status to the sending end through a response frame; S4 The sender resends all frames that the receiver has not received based on the response frame; S5 If the receiving end receives all the messages, it sends a response frame to the sending end, ending the current sending and receiving process; If the receiving end has not received some messages, return to step S3.

2. The UDP reliable transmission method according to claim 1, characterized in that: The message reception status check based on the message information of the 0th frame specifically includes comparing the total message length, total number of message frames and message serial number contained in the message information of the 0th frame at the receiving end with all received messages to confirm whether all messages are received. If not all messages are received, the message serial number of the missing message frame is obtained.

3. The UDP reliable transmission method according to claim 1, characterized in that: After the sender sends the tail frame, if no response frame is received within a preset time interval, a query frame is sent to the receiver.

4. The UDP reliable transmission method according to claim 3, characterized in that: If no response frame is received after sending three inquiry frames, the SOCKET is closed to end the transmission.

5. The UDP reliable transmission method according to claim 1, characterized in that: After receiving the 0th frame, the receiving end initializes data reception and enters the cyclic receiving program.

6. The UDP reliable transmission method according to claim 5, characterized in that: In step S3, after receiving the 0th frame, the receiving end checks whether the 0th frame is received repeatedly. If it is received repeatedly, the 0th frame received later is discarded.

7. The UDP reliable transmission method according to claim 1, characterized in that: If the receiving end does not receive the 0th frame, the subsequently received data frames will be discarded.

8. A UDP reliable transmission device, characterized in that: The method comprises at least one processing unit and at least one storage unit, wherein the storage unit stores a computer program, and when the computer program is executed by the processing unit, the processing unit executes the steps of the method according to any one of claims 1 to 7.

9. A storage medium, characterized in that: It stores a computer program executable by a UDP reliable transmission device. When the computer program runs on the UDP reliable transmission device, the UDP reliable transmission device executes the steps of the method described in any one of claims 1 to 7.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • UDP (User Datagram Protocol) based matchable strategy data transmission method

    CN104618260A

  • Data transmission method and apparatus based on UDP

    CN106453233A

  • Network transmission method and device based on UDP (User Datagram Protocol), network transmission method and device

    CN106789916A

  • Data ferrying method for physical isolation environment

    CN114268454A

  • Video screen projection method and device, electronic equipment and storage medium

    CN116916087A