Transmission method, device and equipment based on UDP (User Datagram Protocol)
By obtaining and processing the serial number of data packets in the UDP transmission method and dynamically adjusting the number of data packets, the problem of poor transmission reliability in the UDP transmission method is solved, and more efficient and reliable data transmission is achieved.
Patent Information
- Application Number
- CN202411964447.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-25
AI Technical Summary
The existing UDP-based transmission methods have the problem of poor transmission reliability, especially in the ad hoc network wireless communication scenario. Since the UDP protocol does not have a built-in acknowledgement and retransmission mechanism, packet loss and instability lead to low transmission reliability.
By obtaining the maximum serial number of the first new transmission packet in the first transmission window of the sender, and generating a new transmission message including the data packet under certain conditions, dynamically adjusting the number of sent data packets to ensure the order and integrity of the data packets, thereby improving transmission efficiency and network capacity.
It realizes dynamic adjustment of the number of sent data packets, improves transmission efficiency and network capacity, ensures the reliability of data transmission, and solves the problem of poor transmission reliability in UDP transmission method.
Smart Images

Figure CN119893581A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a UDP-based transmission method, device and equipment. Background Art
[0002] In the scenario of wireless communication in an ad hoc network, the application software sends data packets to the wireless communication device through the network port, and the wireless communication device then sends the data packets to the receiving end through the air port. After the receiving end receives the data packet at the air port, it sends it to the application software through the network port. During the entire transmission process, the User Datagram Protocol (UDP) is widely used in high-speed data transmission networks due to its advantages of low latency and high throughput.
[0003] However, the UDP protocol itself does not have a built-in confirmation and retransmission mechanism, so data packets are prone to loss during the transmission process. In addition, during air interface transmission, the instability caused by factors such as geographical location and obstruction will further increase the packet loss rate, resulting in the problem of poor transmission reliability in existing UDP transmission methods.
[0004] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention
[0005] The main purpose of the embodiments of the present application is to provide a UDP-based transmission method, apparatus and device, aiming to solve the problem of poor transmission reliability based on UDP in existing methods.
[0006] In a first aspect, an embodiment of the present application provides a UDP-based transmission method, the method comprising:
[0007] Obtaining the maximum sequence number of the first newly transmitted data packet in the first sending window of the sender;
[0008] When the maximum sequence number of the first newly transmitted data packet is less than the sum of the first sequence number and the preset sending window size, generating a first newly transmitted message including the first newly transmitted data packet; wherein the first sequence number is the minimum sequence number of the first transmitted data packet in the first sliding window for which no reception feedback information is received;
[0009] Obtaining the message size of the first newly transmitted message;
[0010] When the message size of the first new transmission message is greater than or equal to the single message size, the first new transmission message is sent to the receiving end.
[0011] In a second aspect, an embodiment of the present application provides a UDP-based transmission method, the method comprising:
[0012] Receive a first newly transmitted message sent by a transmitting end; wherein the first newly transmitted message includes a first newly transmitted data packet in a first transmitting window of the transmitting end; the maximum sequence number of the first newly transmitted data packet is less than the sum of the first sequence number and a preset transmitting window size, and the first sequence number is the minimum sequence number of the first transmitted data packet in the first sliding window for which no receiving feedback information is received; the message size of the first newly transmitted message is less than or equal to a single message size;
[0013] Parsing the first newly transmitted message to obtain m data packets, where m is a positive integer;
[0014] The storage operation of the m data packets is performed in the ascending order of the serial numbers of the m data packets; the storage order of the m data packets matches the order of the serial numbers of the m data packets.
[0015] In a third aspect, an embodiment of the present application provides a UDP-based transmission device, the device comprising:
[0016] A sequence number acquisition module, used to acquire the maximum sequence number of the first newly transmitted data packet in the first sending window of the sender;
[0017] A generating module, configured to generate a first new transmission message including the first new transmission data packet when the maximum sequence number of the first new transmission data packet is less than the sum of the first sequence number and the preset sending window size; wherein the first sequence number is the minimum sequence number of the first transmitted data packet in the first sliding window for which no reception feedback information is received;
[0018] A message size obtaining module, used to obtain the message size of the first newly transmitted message;
[0019] A sending module is used to send the first new transmission message to a receiving end when the message size of the first new transmission message is greater than or equal to the single message size.
[0020] In a fourth aspect, an embodiment of the present application provides a UDP-based transmission device, the device comprising:
[0021] A receiving module, configured to receive a first newly transmitted message sent by a transmitting end; wherein the first newly transmitted message includes a first newly transmitted data packet in a first transmitting window of the transmitting end; the maximum sequence number of the first newly transmitted data packet is less than the sum of the first sequence number and a preset transmitting window size, and the first sequence number is the minimum sequence number of the first transmitted data packet in the first sliding window that has not received receiving feedback information; the message size of the first newly transmitted message is less than or equal to the single message size;
[0022] A parsing module, parsing the first newly transmitted message to obtain m data packets, where m is a positive integer;
[0023] The storage module performs storage operations on the m data packets in an ascending order of the serial numbers of the m data packets; the storage order of the m data packets matches the order of the serial numbers of the m data packets.
[0024] In a fifth aspect, an embodiment of the present application provides a UDP-based transmission device, the device comprising: a memory, a processor, and a computer processing program stored on the memory and executable on the processor, the computer processing program being configured to implement the steps of the UDP-based transmission method as described in the first aspect.
[0025] In a sixth aspect, an embodiment of the present application provides a storage medium having a computer processing program stored thereon, and when the computer processing program is executed by a processor, the steps of the UDP-based transmission method described in the first aspect are implemented.
[0026] In a seventh aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the steps of the method described in the first aspect.
[0027] The present application proposes a UDP-based transmission method, device and equipment. First, the maximum sequence number of the first newly transmitted data packet in the first transmission window of the sender is obtained; secondly, when the maximum sequence number of the first newly transmitted data packet is less than the sum of the first sequence number and the preset transmission window size, a first newly transmitted message including the first newly transmitted data packet is generated; wherein the first sequence number is the minimum sequence number of the first transmitted data packet that has not received the reception feedback information in the first sliding window; then, the message size of the first newly transmitted message is obtained; finally, when the message size of the first newly transmitted message is greater than or equal to the single message size, the first newly transmitted message is sent to the receiving end. In this way, by confirming the backward shift condition of the sliding window, the sender can send a certain number of data packets, thereby dynamically adjusting the number of transmitted data packets, thereby achieving the beneficial effect of improving transmission efficiency and network capacity, and ensuring the reliability of data transmission. In addition, the first newly transmitted message will be sent only when the first newly transmitted message is greater than or equal to the single message size, thereby obtaining the condition of controlling message transmission according to the message size, achieving the purpose of controlling transmission efficiency, and further ensuring the reliability of data transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 This is one of the flow charts of the UDP-based transmission method provided in the embodiment of the present application;
[0029] Figure 2 This is the second flow chart of the UDP-based transmission method provided in the embodiment of the present application;
[0030] Figure 3 It is a schematic diagram of the sending process provided by an embodiment of the present application;
[0031] Figure 4 It is a schematic diagram of a receiving process provided in an embodiment of the present application;
[0032] Figure 5 This is one of the structural schematic diagrams of a UDP-based transmission device provided in an embodiment of the present application;
[0033] Figure 6 This is the second structural diagram of the UDP-based transmission device provided in the embodiment of the present application;
[0034] Figure 7 It is one of the structural schematic diagrams of the electronic device provided in the embodiment of the present application;
[0035] Figure 8 This is the second structural diagram of the electronic device provided in the embodiment of the present application;
[0036] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0037] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0038] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0039] The UDP-based transmission provided by the embodiment of the present application is described in detail below through specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0040] The embodiment of the present application provides a UDP-based transmission method, which is applied to a sending end, such as Figure 1 As shown, the UDP-based transmission method of the embodiment of the present application may include the following steps:
[0041] Step 10, obtaining the maximum sequence number of the first newly transmitted data packet in the first sending window of the sending end;
[0042] Step 20, when the maximum sequence number of the first newly transmitted data packet is less than the sum of the first sequence number and the preset sending window size, generating a first newly transmitted message including the first newly transmitted data packet; wherein the first sequence number is the minimum sequence number of the first transmitted data packet in the first sliding window for which no reception feedback information is received;
[0043] Step 30, obtaining the message size of the first newly transmitted message;
[0044] Step 40: When the message size of the first new message is greater than or equal to the single message size, send the first new message to the receiving end.
[0045] The embodiment of the present application obtains the maximum sequence number of the first new transmission data packet in the first transmission window of the transmitting end; secondly, when the maximum sequence number of the first new transmission data packet is less than the sum of the first sequence number and the preset transmission window size, a first new transmission message including the first new transmission data packet is generated; wherein the first sequence number is the minimum sequence number of the first transmitted data packet that has not received the reception feedback information in the first sliding window; then, the message size of the first new transmission message is obtained; finally, when the message size of the first new transmission message is greater than or equal to the single message size, the first new transmission message is sent to the receiving end. In this way, by confirming the backward shift condition of the sliding window, the transmitting end can send a certain number of data packets, thereby dynamically adjusting the number of transmitted data packets, thereby achieving the beneficial effect of improving transmission efficiency and network capacity, and ensuring reliable data transmission. In addition, the first new transmission message will be sent only when the first new transmission message is greater than or equal to the single message size, thereby obtaining the condition of controlling message transmission according to the message size, achieving the purpose of controlling transmission efficiency, and further ensuring the reliability of data transmission.
[0046] In some embodiments, in the above step 10, a data packet with a maximum sequence number that can be sent within the current sending window is determined.
[0047] In this embodiment, it should be noted that the sending end may be an end that sends data in network communication. The first sending window may be a current sending window, which is used to control the range of sending data. The first new transmission data packet may be all new transmission data packets included in the first sending window. The maximum sequence number may be the maximum sequence number that can be sent within the sliding window. The new transmission data packet may include one or more data packets.
[0048] In some embodiments, in the above step 20, it is checked whether there is enough space outside the current sending window to send a new data packet, that is, it is checked whether the maximum sequence number is less than the sum of the first sequence number and the window size. If the above condition is met, a new message containing the first new transmission data packet is generated and prepared for sending.
[0049] In this embodiment, it should be noted that the first sequence number may be the minimum sequence number of the transmitted data packet in the sliding window that has not yet received confirmation from the receiving party. The preset sending window size may be the size of the sliding window set by the sending end. The first transmitted data packet may be a data packet that has been sent but has not yet received confirmation from the receiving end. The received feedback information may be feedback information sent by the receiving end to the sending end, which may be ack or nack. The first newly transmitted message may be a message containing the first newly transmitted data packet.
[0050] In some embodiments, in the above step 30, the actual size of the generated message is determined.
[0051] In this embodiment, it should be noted that the message size may be the actual size of the first newly transmitted message.
[0052] In some embodiments, in the above step 40, it is checked whether the message size exceeds the single message size. If the message size is greater than the single message size, the first new transmission message is sent to the receiving end.
[0053] In this embodiment, it should be noted that the single message size may be the maximum amount of data that a single message can carry, or the maximum size of a single data packet. The single message size determines the number of tokens that a single data packet can contain.
[0054] In this embodiment, the number of tokens can be used to represent the message size. When the message size of the first newly transmitted message is obtained, the number of tokens of the first newly transmitted message can be calculated according to the rate calculation algorithm, and when the number of tokens of the first newly transmitted message is greater than or equal to the number of tokens included in the single message size, the first newly transmitted message is sent to the receiving end.
[0055] In some implementations, after obtaining the message size of the first newly transmitted message, the method further includes:
[0056] When the message size of the first newly transmitted message is smaller than the single message size, discarding the first newly transmitted message;
[0057] Upon receiving the reception confirmation information of the receiving end for n data packets in the first transmitted data packet, the first sending window is shifted back by n data packets to obtain a second sending window; wherein the second sequence number is n greater than the minimum sequence number of the first transmitted data packet, and the second sequence number is the minimum sequence number of the second transmitted data packet in the second sending window for which the confirmation information of the receiving end has not been received; the maximum sequence number of the second newly transmitted data packet in the second sending window is n greater than the maximum sequence number of the first newly transmitted data packet; and n is a positive integer;
[0058] When the maximum sequence number of the second new transmission data packet is less than the sum of the second sequence number and the sliding window size, generating a second new transmission message including the second new transmission data packet;
[0059] When the message size of the second new transmission message is greater than or equal to the single message size, the second new transmission message is sent to the receiving end.
[0060] In this embodiment, if the message size does not exceed the single message size, it is discarded. When the receiving end confirms that it has successfully received n data packets, the sending end moves its sending window backward by the position of n data packets in order to send a new data packet. Check whether the second new transmission data packet is within the range of the current window (after moving backward). If so, generate a second new transmission message containing these data packets. If the size of the second new transmission message reaches or exceeds the single message size, send this message to the receiving end. By discarding new transmission messages that are smaller than the single message size, the number of small data packets in the network can be reduced, thereby reducing network congestion and improving transmission efficiency. In addition, by waiting for the confirmation information from the receiving end to move the sending window, the sending end can ensure the order and integrity of the data packets, which helps to reduce the possibility of data packet loss and duplicate transmission, thereby improving the reliability of data transmission.
[0061] In this embodiment, it should be noted that the second sending window may be that after receiving a certain number of data packet confirmations, the sending end slides the window backward to include new data packets and form a new sending window. The second sequence number may be the minimum sequence number of the transmitted data packets in the second sending window that have not received confirmation information from the receiving end. The second transmitted data packet may be a data packet that has been sent but has not yet received confirmation in the second sending window. The second newly transmitted data packet may be all newly transmitted data packets included in the second sending window. The reception confirmation information may be confirmation information sent by the receiving end to the sending end, and the confirmation information indicates that the receiving end has received the data packet sent by the sending end. The reception confirmation information may be ack.
[0062] In some implementations, when the message size of the first newly transmitted message is smaller than the size of a single message, the above steps (receiving confirmation information from the receiving end, moving the window backward, generating a message, and determining whether the conditions are met) are performed, and when the conditions are met, a second newly transmitted message is sent to the receiving end.
[0063] In other implementations, if the condition that the message size of the second newly transmitted message is greater than or equal to the single message size is not met, it is necessary to repeat the above steps (receiving confirmation information from the receiving end, moving the window back, generating a message, and determining whether the condition is met). Only when the condition is met, the Nth newly transmitted message is sent to the receiving end, where N is greater than 2.
[0064] In some implementations, the sending of the first new transmission message to the receiving end includes:
[0065] Determine whether there is a retransmission message;
[0066] In the absence of a retransmitted message, directly sending the first newly transmitted message to the receiving end;
[0067] In the case where there is a retransmission message, the retransmission message is sent to the receiving end, and after the sending of the retransmission message is completed, the first new transmission message is sent to the receiving end.
[0068] In this embodiment, before sending the first new transmission message, it is checked whether there are data packets that need to be retransmitted due to transmission errors or other problems. If there are no data packets that need to be retransmitted, the first new transmission message is directly sent to the receiving end. If there are data packets that need to be retransmitted, these retransmission messages are sent to the receiving end first. And after all the data packets that need to be retransmitted are successfully sent, the first new transmission message is sent. By checking and retransmitting lost or damaged data packets, it can be ensured that all data can be received by the receiving end, thereby improving the reliability of data transmission. At the same time, before sending new data, it is ensured that all old data packets have been correctly processed, so that the order and integrity of the data can be maintained. By sending retransmission messages first, network congestion and resource waste can be reduced.
[0069] In this implementation manner, it should be noted that the retransmission message may be a data packet that needs to be resent due to certain reasons (such as transmission error, loss, etc.).
[0070] In some embodiments, the method further comprises at least one of the following:
[0071] generating a first retransmission message including the first data packet upon receiving reception denial information of the first data packet in the first transmitted data packets;
[0072] When the sending time of the second data packet in the first transmitted data packet exceeds a preset time length, a second retransmission message including the second data packet is generated.
[0073] In this embodiment, after sending the first data packet, the confirmation information of the receiving end is waited. If the receiving end returns a negative reception information, indicating that the first data packet has not been successfully received, a first retransmission message of the first data packet will be generated for retransmission. The packet transmission time of the second data packet is recorded and compared with the preset duration. If the transmission time of the second data packet exceeds the preset duration and no confirmation information is received, a second retransmission message of the second data packet is generated for retransmission. Both methods generate a retransmission message when the data packet is not successfully received to ensure that the data can be correctly transmitted to the receiving end, thereby enhancing the reliability of data transmission. By timely retransmitting the data packet that has not been successfully received, the possibility of data loss is reduced and the overall data transmission efficiency is improved. In addition, by controlling the timing of retransmission (based on receiving negative information or timeout), unnecessary network traffic can be reduced, thereby alleviating network congestion. Furthermore, by using the mechanism of preset duration, it is possible to avoid waiting for confirmation information indefinitely, thereby making more efficient use of network resources.
[0074] In this embodiment, it should be noted that the first data packet may be one or more data packets in the first transmitted data packet. The reception negative information may be a negative information sent back by the receiving end, the negative information indicating that the receiving end has not received the data packet sent by the sending end, and the reception negative information may be nack. The first retransmission message may be a retransmission data packet containing the first data packet generated due to the receiving end feeding back the reception negative information. The second data packet may be one or more data packets in the first transmitted data packet. The preset duration may be a time threshold preset in the protocol, used to determine whether a data packet has timed out. The second retransmission message may be a retransmission data packet containing the second data packet generated due to the second data packet sending time exceeding the preset duration.
[0075] The embodiment of the present application also provides a UDP-based transmission method, which is applied to a receiving end, such as Figure 2 As shown, the UDP-based transmission method of the embodiment of the present application may include the following steps:
[0076] Step 50, receiving a first newly transmitted message sent by the transmitting end; wherein the first newly transmitted message includes a first newly transmitted data packet in a first transmitting window of the transmitting end; the maximum sequence number of the first newly transmitted data packet is less than the sum of the first sequence number and a preset transmitting window size, and the first sequence number is the minimum sequence number of the first transmitted data packet in the first sliding window that has not received receiving feedback information; the message size of the first newly transmitted message is greater than or equal to a single message size;
[0077] Step 60, parsing the first newly transmitted message to obtain m data packets, where m is a positive integer;
[0078] Step 70, performing storage operations on the m data packets in ascending order of the serial numbers of the m data packets; the storage order of the m data packets matches the order of the serial numbers of the m data packets.
[0079] In an embodiment of the present application, a first new transmission message sent by a receiving sending end is received, wherein the first new transmission message includes a first new transmission data packet in a first sending window of the sending end, and the maximum sequence number of the first new transmission data packet is less than the sum of the first sequence number and the preset sending window size. Then the first new transmission message is parsed to obtain m data packets, and the m data packets are stored in the order of the sequence numbers of the m data packets from small to large. By storing the data packets in sequence by sequence number, the order of data can be ensured. Secondly, controlling the sending window and sequence number can reduce the loss and duplication of data packets and improve the reliability of data transmission.
[0080] In this embodiment, it should be noted that the logic for receiving and processing other newly transmitted messages is similar.
[0081] In some embodiments, in the above step 50, the receiving end receives the first new transmission message sent by the sending end, and the first new transmission message includes the first new transmission data packet in the first transmission window. The maximum sequence number of the first new transmission data packet is limited and is less than the sum of the first sequence number and the preset transmission window size. The size of the first new transmission message is greater than or equal to the single message size.
[0082] In some embodiments, in the above step 60, the receiving end parses the first newly transmitted message to obtain m data packets therefrom.
[0083] In this embodiment, it should be noted that the m data packets may be the number of data packets parsed from the first new transmission message, m is a positive integer, and the m data packets may include all the data packets in the first new transmission message sent by the sender, or some data packets (lost).
[0084] In some embodiments, in the above step 70, the storage operation of the m data packets is performed in the order of the serial numbers of the m data packets from small to large, ensuring that the storage order matches the sequence of the serial numbers.
[0085] In some implementations, the performing of the storage operation on the m data packets includes:
[0086] For each data packet in the m data packets, comparing the sequence number of the data packet with the sequence number corresponding to the storage file;
[0087] When the sequence number of the data packet is the same as the sequence number corresponding to the storage file, the data packet is stored in the storage file, and the sequence number corresponding to the storage file is increased by 1;
[0088] When the sequence number of the data packet is different from the current sequence number of the storage file, the data packet is stored in the cache file.
[0089] In this embodiment, for each of the m data packets, its sequence number is compared with the sequence number available for storage at the current position in the storage file. If the sequence number of the data packet matches the sequence number available for storage at the current position of the storage file, this means that the data packet is received in sequence. The data packet is stored in the storage file, and the sequence number of the storage file is updated by adding 1 to prepare for receiving the next sequential data packet. If the sequence number of the data packet does not match the current sequence number of the storage file, this means that the data packet is not received in sequence. The data packet is stored in a cache file, waiting for the missing data packet to arrive so that it can be reassembled in the correct order and stored in the storage file in the future. By comparing the sequence numbers and storing the data packets in sequence, the order of the data is ensured. By storing the data packets that arrive out of sequence in the cache file until all the missing data packets arrive, the integrity of the data can be ensured. By distinguishing between storage files and cache files, the storage space can be managed more efficiently to avoid unnecessary data overwriting and retransmission.
[0090] In this embodiment, it should be noted that the sequence number may be a unique identifier for each data packet, which is used to ensure the order and integrity of the data. The storage file may be a file for permanently storing data packets that have been successfully received and arranged in sequence by sequence number. The cache file may be a file for temporarily storing data packets that have not yet been received in sequence by sequence number until they can be correctly sorted and stored in the storage file.
[0091] In some embodiments, the method further comprises:
[0092] Determine whether the cache file is empty;
[0093] When the cache file is not empty, if there is a target data packet with a serial number corresponding to the storage file in the cache file, the target data packet is stored in the storage file, and the serial number corresponding to the storage file is increased by 1, and so on, until the cache file is empty.
[0094] In this embodiment, it is checked whether the cache file is empty. If the cache file is not empty, it is checked whether there is a target data packet in the cache file whose sequence number matches the current sequence number of the storage file. If a matching sequence number is found, the target data packet is moved from the cache file to the storage file, and the sequence number of the storage file is updated. The steps are repeated until the cache file is empty, ensuring that all data packets that can be stored in sequence have been processed. By storing the data packets in the cache file in sequence in a timely manner in the storage file, the residence time of the data packets in the cache is reduced, and the efficiency of data transmission is improved. Secondly, by dynamically transferring the data packets from the cache file to the storage file, the use of storage space is optimized, ensuring that the storage space is effectively utilized. Then, by ensuring that the data packets are stored in sequence, the risk of data packet loss due to a full cache file is reduced. In addition, by ensuring the sequence and integrity of the data packets, the reliability of data transmission is enhanced, especially in the case of poor network conditions or data packet transmission delays.
[0095] In this embodiment, it should be noted that the target data packet may be a data packet whose sequence number in the cache file matches the current sequence number of the storage file.
[0096] In some implementations, after each data packet is stored in the storage file and the sequence number corresponding to the storage file is increased by 1, it is checked whether the cache file is empty. If the cache file is not empty, it is checked whether there is a target data packet in the cache file whose sequence number matches the current sequence number of the storage file. If a matching sequence number is found, the target data packet is moved from the cache file to the storage file, and the sequence number of the storage file is updated. The steps are repeated until the cache file is empty, ensuring that all data packets that can be stored in sequence have been processed.
[0097] In other implementations, after polling m data packets, check whether the cache file is empty. If the cache file is not empty, check whether there is a target data packet in the cache file whose sequence number matches the current sequence number of the storage file. If a matching sequence number is found, move the target data packet from the cache file to the storage file, and update the sequence number of the storage file. Repeat the steps until the cache file is empty, ensuring that all data packets that can be stored in sequence have been processed.
[0098] It should be noted that the various embodiments, implementation methods and implementation methods provided in the embodiments of the present application can be implemented independently or in combination without conflicting with each other. The specific implementation method can be determined based on actual needs, and the embodiments of the present application are not limited to this.
[0099] For easier understanding, see Figure 3 , Figure 3 It is a schematic diagram of the sending process applied to the sending end in an embodiment of the UDP-based transmission method provided in the present application.
[0100] By judging vtms<vtA+winsize (vtms corresponds to the maximum sequence number of the first new transmission data packet, vtA corresponds to the first sequence number, and winsize corresponds to the preset sending window size), it is determined whether the sliding window meets the conditions for the backward shift. If so, the data in vts-vtms (vts corresponds to the minimum sequence number of the first new transmission data packet) in the current sliding window is packaged to generate message 1 (message 1 corresponds to the first new transmission message). Then, by calculating the token of message 1 and comparing it with the single message size, it is determined whether the message transmission conditions are met (the message transmission conditions correspond to whether the message size of the first new transmission message is greater than or equal to the single message size) to control the transmission rate.
[0101] If the token of message 1 is greater than or equal to the single message size, it means that message 1 meets the single message size transmission conditions. Before transmitting message 1, further determine whether there is a retransmission message (whether the confirmation information of the transmitted data packet is received within the preset time, and whether the confirmation information of the transmitted data packet received within the preset time is ack). If there is a retransmission message, the retransmission message will be transmitted first (retransmission). If there is no retransmission message, message 1 can be transmitted (new transmission).
[0102] If the token of message 1 is smaller than the size of a single message, message 1 does not meet the message transmission conditions, and further determines whether the ack queue is empty. If the ack queue is not empty and the ack message is parsed, the sliding window is moved back, vtA and vtms are updated, new vtA and vtms are obtained, and then the data of vts-new vtms is packaged to generate message 2. Then determine whether the token of message 2 is greater than or equal to the size of a single message to determine whether message 2 meets the message transmission conditions, and so on, until all data packets are transmitted.
[0103] For easier understanding, see Figure 4 , Figure 4 It is a schematic diagram of a receiving process applied to a receiving end in an embodiment of a UDP-based transmission method provided in the present application.
[0104] After receiving the packet, the receiver first unpacks it and takes out the sn number (sn number is the abbreviation of the serial number of the data packet). If the taken out recv_sn number (recv_sn number corresponds to the serial number of the data packet) is the same as the position of the current record file (storage file) file_current_sn (file_current_sn corresponds to the serial number that can be used for storage at the current position of the storage file), then the packet is directly written to the file (storage file), and file_current_sn+1. Find whether the value in the list recv_list[file_current_sn] (recv_list[file_current_sn] corresponds to the serial number of the data packet in the cache file and the serial number that can be used for storage at the current position of the storage file) is None. If it is not None, write the value to the file and file_current_sn+1. Find the value of recv_list[file_current_sn] again to see if it is None. If it is not None, write the value to the file, until the value found is None. If the retrieved recv_sn number is different from the location of the current record file file_current_sn, the data is unpacked and stored in recv_list[recv_sn] (cache file).
[0105] If the number of received data packets exceeds the size of the sliding window, the data packets exceeding the window size are discarded, and the receiving end returns a nack every 500ms or 3600 packets.
[0106] Reference Figure 5 One embodiment of the present application provides a UDP-based transmission device, the device comprising:
[0107] A sequence number acquisition module 501, used to acquire the maximum sequence number of the first newly transmitted data packet in the first sending window of the sending end;
[0108] A generating module 502 is configured to generate a first new transmission message including the first new transmission data packet when the maximum sequence number of the first new transmission data packet is less than the sum of the first sequence number and the preset sending window size; wherein the first sequence number is the minimum sequence number of the first transmitted data packet in the first sliding window for which no reception feedback information is received;
[0109] A message size obtaining module 503, used to obtain the message size of the first newly transmitted message;
[0110] The sending module 504 is used to send the first new transmission message to the receiving end when the message size of the first new transmission message is greater than or equal to the single message size.
[0111] It should be noted that the present device embodiment and the above method embodiment are based on the same inventive concept, so the content of the above method embodiment is also applicable to the present device embodiment and will not be repeated here.
[0112] Reference Figure 6 One embodiment of the present application provides a UDP-based transmission device, the device comprising:
[0113] The receiving module 601 is used to receive a first newly transmitted message sent by a sending end; wherein the first newly transmitted message includes a first newly transmitted data packet in a first sending window of the sending end; the maximum sequence number of the first newly transmitted data packet is less than the sum of the first sequence number and the preset sending window size, and the first sequence number is the minimum sequence number of the first transmitted data packet in the first sliding window that has not received reception feedback information; the message size of the first newly transmitted message is less than or equal to the single message size;
[0114] The parsing module 602 parses the first newly transmitted message to obtain m data packets, where m is a positive integer;
[0115] The storage module 603 performs storage operations on the m data packets in the order of the serial numbers of the m data packets from small to large; the storage order of the m data packets matches the order of the serial numbers of the m data packets.
[0116] It should be noted that the present device embodiment and the above method embodiment are based on the same inventive concept, so the content of the above method embodiment is also applicable to the present device embodiment and will not be repeated here.
[0117] Alternatively, if Figure 7 As shown, an embodiment of the present application also provides an electronic device 700, including a processor 701 and a memory 702, wherein the memory 702 stores programs or instructions that can be executed on the processor 701, and when the program or instructions are executed by the processor 701, the various steps of the above-mentioned UDP-based transmission method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they are not repeated here.
[0118] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.
[0119] Figure 8 A schematic diagram of the hardware structure of an electronic device implementing an embodiment of the present application.
[0120] The electronic device 800 includes but is not limited to: a radio frequency unit 801, a network module 802, an audio output unit 803, an input unit 804, a sensor 805, a display unit 806, a user input unit 807, an interface unit 808, a memory 809, and a processor 810 and other components.
[0121] Those skilled in the art will appreciate that the electronic device 800 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 810 via a power management device, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management device. Figure 8 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0122] The processor 810 is configured to:
[0123] Obtaining the maximum sequence number of the first newly transmitted data packet in the first sending window of the sender;
[0124] When the maximum sequence number of the first newly transmitted data packet is less than the sum of the first sequence number and the preset sending window size, generating a first newly transmitted message including the first newly transmitted data packet; wherein the first sequence number is the minimum sequence number of the first transmitted data packet in the first sliding window for which no reception feedback information is received;
[0125] Obtaining the message size of the first newly transmitted message;
[0126] When the message size of the first new transmission message is greater than or equal to the single message size, the first new transmission message is sent to the receiving end.
[0127] In some implementations, the processor 810 is further configured to:
[0128] When the message size of the first newly transmitted message is smaller than the single message size, discarding the first newly transmitted message;
[0129] Upon receiving the reception confirmation information of the receiving end for n data packets in the first transmitted data packet, the first sending window is shifted back by n data packets to obtain a second sending window; wherein the second sequence number is n greater than the minimum sequence number of the first transmitted data packet, and the second sequence number is the minimum sequence number of the second transmitted data packet in the second sending window for which the confirmation information of the receiving end has not been received; the maximum sequence number of the second newly transmitted data packet in the second sending window is n greater than the maximum sequence number of the first newly transmitted data packet; and n is a positive integer;
[0130] When the maximum sequence number of the second new transmission data packet is less than the sum of the second sequence number and the sliding window size, generating a second new transmission message including the second new transmission data packet;
[0131] When the message size of the second new transmission message is greater than or equal to the single message size, the second new transmission message is sent to the receiving end.
[0132] In some implementations, the processor 810 is further configured to:
[0133] Determine whether there is a retransmission message;
[0134] In the absence of a retransmitted message, directly sending the first newly transmitted message to the receiving end;
[0135] In the case where there is a retransmission message, the retransmission message is sent to the receiving end, and after the sending of the retransmission message is completed, the first new transmission message is sent to the receiving end.
[0136] In some implementations, the processor 810 is further configured to:
[0137] generating a first retransmission message including the first data packet upon receiving reception denial information of the first data packet in the first transmitted data packets;
[0138] When the sending time of the second data packet in the first transmitted data packet exceeds a preset time length, a second retransmission message including the second data packet is generated.
[0139] In some implementations, the processor 810 is further configured to:
[0140] Receive a first newly transmitted message sent by a transmitting end; wherein the first newly transmitted message includes a first newly transmitted data packet in a first transmitting window of the transmitting end; the maximum sequence number of the first newly transmitted data packet is less than the sum of the first sequence number and a preset transmitting window size, and the first sequence number is the minimum sequence number of the first transmitted data packet in the first sliding window for which no receiving feedback information is received; the message size of the first newly transmitted message is greater than or equal to a single message size;
[0141] Parsing the first newly transmitted message to obtain m data packets, where m is a positive integer;
[0142] The storage operation of the m data packets is performed in the ascending order of the serial numbers of the m data packets; the storage order of the m data packets matches the order of the serial numbers of the m data packets.
[0143] In some implementations, the processor 810 is further configured to:
[0144] For each data packet in the m data packets, comparing the sequence number of the data packet with the sequence number corresponding to the storage file;
[0145] When the sequence number of the data packet is the same as the sequence number corresponding to the storage file, the data packet is stored in the storage file, and the sequence number corresponding to the storage file is increased by 1;
[0146] When the sequence number of the data packet is different from the current sequence number of the storage file, the data packet is stored in the cache file.
[0147] In some implementations, the processor 810 is further configured to:
[0148] Determine whether the cache file is empty;
[0149] When the cache file is not empty, if there is a target data packet with a serial number corresponding to the storage file in the cache file, the target data packet is stored in the storage file, and the serial number corresponding to the storage file is increased by 1, and so on, until the cache file is empty.
[0150] It should be understood that in the embodiment of the present application, the input unit 804 may include a graphics processor (Graphics Processing Unit, GPU) 8041 and a microphone 8042, and the graphics processor 8041 processes the image data of the static picture or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 806 may include a display panel 8061, and the display panel 8061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 807 includes a touch panel 8071 and at least one of other input devices 8072. The touch panel 8071 is also called a touch screen. The touch panel 8071 may include two parts: a touch detection device and a touch controller. Other input devices 8072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.
[0151] The memory 809 can be used to store software programs and various data. The memory 809 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating device, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 809 may include a volatile memory or a non-volatile memory, or the memory 809 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 809 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
[0152] The processor 810 may include one or more processing units; optionally, the processor 810 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to the operating device, the user interface, and the application program, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 810.
[0153] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned UDP-based transmission method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0154] An embodiment of the present application also provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned UDP-based transmission method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0155] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0156] It should be noted that, in this article, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises one..." does not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be noted that the scope of the method and device in the embodiment of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0157] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0158] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0159] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A UDP-based transmission method, applied to a sending end, characterized in that: include: Obtaining the maximum sequence number of the first newly transmitted data packet in the first sending window of the sender; When the maximum sequence number of the first newly transmitted data packet is less than the sum of the first sequence number and the preset sending window size, generating a first newly transmitted message including the first newly transmitted data packet; wherein the first sequence number is the minimum sequence number of the first transmitted data packet in the first sliding window for which no reception feedback information is received; Obtaining the message size of the first newly transmitted message; When the message size of the first new transmission message is greater than or equal to the single message size, the first new transmission message is sent to the receiving end.
2. The method according to claim 1, characterized in that After obtaining the message size of the first new transmission message, the method further includes: When the message size of the first newly transmitted message is smaller than the single message size, discarding the first newly transmitted message; Upon receiving the reception confirmation information of the receiving end for n data packets in the first transmitted data packet, the first sending window is shifted back by n data packets to obtain a second sending window; wherein the second sequence number is n greater than the minimum sequence number of the first transmitted data packet, and the second sequence number is the minimum sequence number of the second transmitted data packet in the second sending window for which the confirmation information of the receiving end has not been received; the maximum sequence number of the second newly transmitted data packet in the second sending window is n greater than the maximum sequence number of the first newly transmitted data packet; and n is a positive integer; When the maximum sequence number of the second new transmission data packet is less than the sum of the second sequence number and the sliding window size, generating a second new transmission message including the second new transmission data packet; When the message size of the second new transmission message is greater than or equal to the single message size, the second new transmission message is sent to the receiving end.
3. The method according to claim 1, characterized in that The sending the first new transmission message to the receiving end includes: Determine whether there is a retransmission message; In the absence of a retransmitted message, directly sending the first newly transmitted message to the receiving end; In the case where there is a retransmission message, the retransmission message is sent to the receiving end, and after the sending of the retransmission message is completed, the first new transmission message is sent to the receiving end.
4. The method according to claim 3, characterized in that The method further comprises at least one of the following: generating a first retransmission message including the first data packet upon receiving reception denial information of the first data packet in the first transmitted data packets; When the sending time of the second data packet in the first transmitted data packet exceeds a preset time length, a second retransmission message including the second data packet is generated.
5. A UDP-based transmission method, applied to a receiving end, characterized in that: include: Receive a first newly transmitted message sent by a transmitting end; wherein the first newly transmitted message includes a first newly transmitted data packet in a first transmitting window of the transmitting end; the maximum sequence number of the first newly transmitted data packet is less than the sum of the first sequence number and a preset transmitting window size, and the first sequence number is the minimum sequence number of the first transmitted data packet in the first sliding window for which no receiving feedback information is received; the message size of the first newly transmitted message is greater than or equal to a single message size; Parsing the first newly transmitted message to obtain m data packets, where m is a positive integer; The storage operation of the m data packets is performed in the ascending order of the serial numbers of the m data packets; the storage order of the m data packets matches the order of the serial numbers of the m data packets.
6. The method according to claim 5, characterized in that The performing of the storage operation on the m data packets comprises: For each data packet in the m data packets, comparing the sequence number of the data packet with the sequence number corresponding to the storage file; When the sequence number of the data packet is the same as the sequence number corresponding to the storage file, the data packet is stored in the storage file, and the sequence number corresponding to the storage file is increased by 1; When the sequence number of the data packet is different from the current sequence number of the storage file, the data packet is stored in the cache file.
7. The method according to claim 6, characterized in that The method further comprises: Determine whether the cache file is empty; When the cache file is not empty, if there is a target data packet with a serial number corresponding to the storage file in the cache file, the target data packet is stored in the storage file, and the serial number corresponding to the storage file is increased by 1, and so on, until the cache file is empty.
8. A transmission device based on UDP, characterized in that: The device comprises: A sequence number acquisition module, used to acquire the maximum sequence number of the first newly transmitted data packet in the first sending window of the sender; A generating module, configured to generate a first new transmission message including the first new transmission data packet when the maximum sequence number of the first new transmission data packet is less than the sum of the first sequence number and the preset sending window size; wherein the first sequence number is the minimum sequence number of the first transmitted data packet in the first sliding window for which no reception feedback information is received; A message size obtaining module, used to obtain the message size of the first newly transmitted message; A sending module is used to send the first new transmission message to a receiving end when the message size of the first new transmission message is greater than or equal to the single message size.
9. A transmission device based on UDP, characterized in that: The device comprises: A receiving module, configured to receive a first newly transmitted message sent by a transmitting end; wherein the first newly transmitted message includes a first newly transmitted data packet in a first transmitting window of the transmitting end; the maximum sequence number of the first newly transmitted data packet is less than the sum of the first sequence number and a preset transmitting window size, and the first sequence number is the minimum sequence number of the first transmitted data packet in the first sliding window that has not received receiving feedback information; the message size of the first newly transmitted message is less than or equal to the single message size; A parsing module, parsing the first newly transmitted message to obtain m data packets, where m is a positive integer; The storage module performs storage operations on the m data packets in an ascending order of the serial numbers of the m data packets; the storage order of the m data packets matches the order of the serial numbers of the m data packets.
10. A transmission device based on UDP, characterized in that: The device comprises: a memory, a processor, and a computer processing program stored in the memory and executable on the processor, wherein the computer processing program is configured to implement the steps of the UDP-based transmission method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Adaptive reliable multi-window data transmission method based on UDP
CN109379355A
Transmission confirmation method and device, equipment and storage medium
CN112291047A
RLC data transmission method and apparatus, computer device, and readable medium
WO2024051240A1