Data transmission method and device
By adaptively selecting the transmission protocol and data encoding processing, the problem of data transmission errors caused by a single transmission protocol in time-varying network environments is solved, and efficient data transmission is achieved in unstable network environments.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA SATENT NETWORK APPLICATION RESEARCH INSTITUTE CO LTD
- Filing Date
- 2024-11-11
- Publication Date
- 2026-05-12
AI Technical Summary
In time-varying network environments, using a single transport protocol (such as TCP or UDP) can lead to data transmission errors, especially in weak network environments. TCP's congestion control and cumulative acknowledgment mechanism cause a decrease in throughput, while UDP's unreliability leads to problems such as data loss, duplication, and out-of-order delivery.
By obtaining the current number of threads and transmission rate of the first and second transmission protocols, the transmission protocol is adaptively selected, and data blocks are encoded when necessary. Taking advantage of the higher reliability of TCP than UDP, a suitable transmission protocol is selected for data transmission.
It improves the accuracy of data transmission, avoids data loss, duplication, and out-of-order issues caused by a single transmission protocol, and achieves efficient data transmission in unstable network environments.
Smart Images

Figure CN122027718A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communications, and more specifically, to a method and apparatus for transmitting data. Background Technology
[0002] When dealing with large data transmission tasks, TCP, as a reliable transport protocol, can efficiently achieve complete data transmission under stable network conditions. However, in weak network environments, due to the higher packet loss rate, TCP's congestion control and cumulative acknowledgment mechanisms lead to a decrease in throughput, resulting in a significant performance degradation of TCP in such environments. While UDP offers faster transmission rates than TCP in weak network conditions, it is unreliable and prone to data loss, duplication, and out-of-order delivery.
[0003] TCP and UDP transmissions each have their advantages and disadvantages depending on the network transmission scenario. In time-varying network environments where round-trip time (RTT) and packet loss rate change over time, using a single transmission protocol will have corresponding drawbacks, leading to data transmission errors.
[0004] There is currently no effective solution to the above problems. Summary of the Invention
[0005] This invention provides a method and apparatus for transmitting data, which at least solves the problem of data transmission errors caused by using a single transmission protocol in related technologies.
[0006] According to an embodiment of the present invention, a method for transmitting data is provided, comprising: obtaining the current number of threads of a first transmission protocol and the transmission rate of the first transmission protocol to obtain a first number of threads and a first transmission rate; obtaining the current number of threads of a second transmission protocol and the transmission rate of the second transmission protocol to obtain a second number of threads and a second transmission rate; determining a transmission protocol for transmitting a target data block based on the first number of threads and the first transmission rate, and the second number of threads and the second transmission rate; if it is determined that the target data block will be transmitted via the second transmission protocol, encoding the target data block using a target encoding method, and transmitting the encoded target data block via the second transmission protocol, wherein the reliability of the first transmission protocol is higher than that of the second transmission protocol; if it is determined that the target data block will be transmitted via the first transmission protocol, transmitting the target data block via the first transmission protocol.
[0007] In one exemplary embodiment, determining the transmission protocol for transmitting a target data block based on the first number of threads and the first transmission rate, as well as the second number of threads and the second transmission rate, includes: determining whether the first number of threads is zero; if the first number of threads is zero, determining that the first transmission protocol transmits the target data block; if the first number of threads is non-zero, determining whether the second number of threads is zero; if the second number of threads is zero, determining that the second transmission protocol transmits the target data block.
[0008] In one exemplary embodiment, determining the transmission protocol for transmitting the target data block based on the first number of threads and the first transmission rate, as well as the second number of threads and the second transmission rate, further includes: if both the first number of threads and the second number of threads are non-zero, determining whether the first transmission rate and the second transmission rate are equal; if the first transmission rate and the second transmission rate are equal, determining the transmission protocol with the smaller current number of threads to transmit the target data block.
[0009] In one exemplary embodiment, determining the transmission protocol with the smaller current number of threads to transmit the target data block when the first transmission rate and the second transmission rate are equal includes: determining the first transmission protocol to transmit the target data block when the first transmission rate and the second transmission rate are equal and the first number of threads is less than or equal to the second number of threads; and determining the second transmission protocol to transmit the target data block when the first transmission rate and the second transmission rate are equal and the first number of threads is greater than the second number of threads.
[0010] In one exemplary embodiment, determining the transmission protocol for transmitting the target data block based on the first number of threads and the first transmission rate, as well as the second number of threads and the second transmission rate, further includes: when both the first number of threads and the second number of threads are non-zero and the first transmission rate is not equal to the second transmission rate, determining the transmission protocol with the larger transmission rate to transmit the target data block.
[0011] In one exemplary embodiment, the method further includes: when it is determined that the target data block is transmitted via the first transmission protocol, incrementing the current thread count of the first transmission protocol by one, and transmitting the target data block via the first transmission protocol; when the target data block is transmitted via the first transmission protocol, decrementing the current thread count of the first transmission protocol by one, obtaining the transmission rate of the target data block transmitted via the first transmission protocol, and obtaining a third transmission rate; and updating the transmission rate of the first transmission protocol to the third transmission rate.
[0012] In one exemplary embodiment, the method further includes: when it is determined that the target data block is transmitted via the second transmission protocol, incrementing the current thread count of the second transmission protocol by one; when the encoded target data block is transmitted via the second transmission protocol, decrementing the current thread count of the second transmission protocol by one, and obtaining the transmission rate of the target data block transmitted via the second transmission protocol to obtain a fourth transmission rate; and updating the transmission rate of the second transmission protocol to the fourth transmission rate.
[0013] According to another embodiment of the present invention, an apparatus for transmitting data blocks is provided, comprising: a first acquisition module, configured to acquire the current number of threads of a first transmission protocol and the transmission rate of the first transmission protocol, to obtain a first number of threads and a first transmission rate; a second acquisition module, configured to acquire the current number of threads of a second transmission protocol and the transmission rate of the second transmission protocol, to obtain a second number of threads and a second transmission rate; a determination module, configured to determine a transmission protocol for transmitting a target data block based on the first number of threads and the first transmission rate, and the second number of threads and the second transmission rate; a first transmission module, configured to, when it is determined that the target data block will be transmitted via the second transmission protocol, encode the target data block using a target encoding method, and transmit the encoded target data block via the second transmission protocol, wherein the reliability of the first transmission protocol is higher than that of the second transmission protocol; and a second transmission module, configured to, when it is determined that the target data block will be transmitted via the first transmission protocol, transmit the target data block via the first transmission protocol.
[0014] According to yet another embodiment of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored therein, wherein the computer program, when executed by a processor, implements the steps of the method described in any of the preceding claims.
[0015] According to yet another embodiment of the present invention, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0016] According to yet another embodiment of the present invention, a computer program product is also provided, comprising a computer program that, when executed by a processor, implements the steps of the method described in any of the preceding claims.
[0017] This invention achieves adaptive selection of the transmission protocol for data transmission by determining the transmission protocol of the target data block based on the current number of threads and transmission rate of both the first and second transmission protocols. Furthermore, it avoids encoding the target data block using a target encoding method when the second transmission protocol is determined to be used, thus preventing data loss, duplication, and out-of-order delivery due to the lower reliability of the second transmission protocol. Therefore, it solves the problem of data transmission errors caused by using a single transmission protocol, thereby improving the accuracy of data transmission. Attached Figure Description
[0018] Figure 1 This is a hardware structure block diagram of a mobile terminal for a data transmission method according to an embodiment of the present invention.
[0019] Figure 2 This is a flowchart of a data transmission method according to an embodiment of the present invention;
[0020] Figure 3 This is a flowchart illustrating an embodiment of the present invention. Figure 1 ;
[0021] Figure 4 This is a flowchart illustrating an embodiment of the present invention. Figure 2 ;
[0022] Figure 5 This is a structural block diagram of an apparatus for transmitting data blocks according to an embodiment of the present invention. Detailed Implementation
[0023] The embodiments of the present invention will be described in detail below with reference to the accompanying drawings and examples.
[0024] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0025] The methods and embodiments provided in this application can be executed on a mobile terminal, a computer terminal, or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a hardware structure block diagram of a mobile terminal for a data transmission method according to an embodiment of the present invention. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0026] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the data transmission method in this embodiment of the invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thereby implementing the aforementioned method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0027] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0028] This embodiment provides a method for transmitting data on the aforementioned mobile terminal. Figure 2 This is a flowchart of a data transmission method according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps:
[0029] Step S202: Obtain the current number of threads of the first transmission protocol and the transmission rate of the first transmission protocol to obtain the first number of threads and the first transmission rate;
[0030] The first transmission protocol mentioned above is the TCP transmission protocol, which can establish a TCP connection between the client and the server as a control connection.
[0031] The TCP_RATE variable can be defined to store the average transmission rate (including the first transmission rate mentioned above) of the last data block transmitted using TCP, with an initial value of 0. The TCP_N variable can be defined to store the number of threads currently using TCP for transmission (including the first transmission rate mentioned above), with an initial value of 0.
[0032] Step S204: Obtain the current number of threads of the second transmission protocol and the transmission rate of the second transmission protocol to obtain the second number of threads and the second transmission rate;
[0033] The second transport protocol is UDP. UDP_RATE is defined to store the average transmission rate of the last data block transmitted using UDP, with an initial value of 0. UDP_N is defined to store the number of threads currently using UDP for transmission, with an initial value of 0.
[0034] Step S206: Determine the transmission protocol of the target data block based on the first number of threads and the first transmission rate, as well as the second number of threads and the second transmission rate.
[0035] Specifically, such as Figure 3 The flowchart shown includes the following steps:
[0036] Step S301: Determine whether the number of the first threads is zero; if the number of the first threads is zero, proceed to step S302; if the number of the first threads is non-zero, proceed to step S303.
[0037] Step S302: Determine that the first transmission protocol transmits the target data block;
[0038] Step S303: Determine whether the second thread count is zero. If the second thread count is zero, proceed to step S304; otherwise, proceed to step S305.
[0039] Step S304: Determine that the second transmission protocol transmits the target data block.
[0040] Step S305: If both the first number of threads and the second number of threads are non-zero, determine whether the first transmission rate and the second transmission rate are equal; if the first transmission rate and the second transmission rate are equal, proceed to step S306; if the first transmission rate and the second transmission rate are not equal, proceed to step S307.
[0041] Step S306: Determine whether the first number of threads is less than or equal to the second number of threads. If yes, determine that the first transmission protocol transmits the target data block; otherwise, determine that the second transmission protocol transmits the target data block.
[0042] Step S307: Determine the transmission protocol with a higher transmission rate to transmit the target data block.
[0043] In the above embodiments, the transmission advantages of TCP and UDP in different network environments are leveraged, and multi-threaded block transmission is used to achieve efficient data transmission under unstable network transmission links.
[0044] Step S208: If it is determined that the target data block is transmitted through the second transmission protocol, the target data block is encoded by the target encoding method, and the encoded target data block is transmitted through the second transmission protocol, wherein the reliability of the first transmission protocol is higher than that of the second transmission protocol.
[0045] Step S210: If it is determined that the target data block is to be transmitted via the first transmission protocol, the target data block is transmitted via the first transmission protocol.
[0046] The target encoding method mentioned above can be fountain code.
[0047] Optionally, the entity performing the above steps may be a background processor or other devices with similar processing capabilities, or a machine that integrates at least an image acquisition device and a data processing device. The image acquisition device may include an image acquisition module such as a camera, and the data processing device may include a terminal such as a computer or a mobile phone, but is not limited thereto.
[0048] Through the above steps, the transmission protocol for the target data block is determined based on the current number of threads and transmission rate of the first and second transmission protocols, achieving the goal of adaptively selecting the transmission protocol for data transmission. Furthermore, when the target data block is determined to be transmitted via the second transmission protocol, it is encoded using a target encoding method to avoid data loss, duplication, and out-of-order issues caused by the lower reliability of the second transmission protocol. Therefore, the problem of data transmission errors caused by using a single transmission protocol can be solved, thereby improving the accuracy of data transmission.
[0049] The execution order of steps S202 and S204 can be interchanged; that is, step S204 can be executed first, and then step S202 can be executed.
[0050] As an optional implementation, such as Figure 3 The flowchart shown also includes the following steps:
[0051] Step S309: If it is determined that the target data block is transmitted through the first transmission protocol, increment the current thread count of the first transmission protocol by one.
[0052] Step S310: After transmitting the target data block through the first transmission protocol, decrement the current thread count of the first transmission protocol by one, and obtain the transmission rate of the target data block transmitted by the first transmission protocol to obtain the third transmission rate.
[0053] Step S311: Update the transmission rate of the first transmission protocol to the third transmission rate.
[0054] Step S312: If it is determined that the target data block is transmitted through the second transmission protocol, increment the current thread count of the second transmission protocol by one.
[0055] Step S313: After transmitting the encoded target data block through the second transmission protocol, decrement the current thread count of the second transmission protocol by one, and obtain the transmission rate of the target data block transmitted by the second transmission protocol to obtain the fourth transmission rate.
[0056] Step S314: Update the transmission rate of the second transmission protocol to the fourth transmission rate.
[0057] As an optional implementation, such as Figure 4 The flowchart shown includes the following steps before transmitting the target data block:
[0058] Step S401: Establish a TCP connection between the client and the server as a control connection. The fountain code uses the LT code and is based on the UDP transport layer protocol. The client application layer defines a value of 2N as the maximum value of the total number of TCP and UDP threads. The value of N can be set according to the actual situation, such as 10, 20, etc.
[0059] Step S402: Define TCP_RATE to store the average transmission rate of the last data block transmitted using TCP, with an initial value of 0. Define TCP_N to store the number of threads currently using TCP for transmission, with an initial value of 0; define UDP_RATE to store the average transmission rate of the last data block transmitted using UDP, with an initial value of 0. Define UDP_N to store the number of threads currently using UDP for transmission, with an initial value of 0.
[0060] Step S403: The client application layer defines a callback function pointer, which is used by this algorithm to notify the application layer of the transmission result of each data block;
[0061] In step S404, if the transmission task has not ended, the client application layer continues to put the block universal unique identifier (uuid) and block data into the cache; if TCP_N+UDP_N<2N, then the data block is retrieved from the cache and transmitted accordingly.
[0062] In step S404, the client algorithm notifies the server of the block UUID through the control channel and selects a transmission mode between TCP and UDP for transmission. The transmission mode selection follows these principles:
[0063] If the number of TCP connections is 0, then TCP_N is incremented by 1, and TCP transmission is selected;
[0064] If the number of UDP connections is 0, then UDP_N is incremented by 1, and fountain code transmission is selected;
[0065] If TCP_RATE == UDP_RATE, choose the transmission method with fewer transmission threads;
[0066] If TCP_RATE ≠ UDP_RATE, choose the transmission method with the higher transmission rate.
[0067] Until the data blocks are completely transmitted or an error occurs, the result is notified to the application layer through a callback function, and the thread count for the corresponding transmission method is decremented by one;
[0068] If a data block is used correctly for TCP transmission, calculate the average transmission rate of the data block after the thread has finished transmitting it, and write it into TCP_RATE; if a data block is used correctly for UDP transmission, calculate the average transmission rate of the data block after the thread has finished transmitting it, and write it into UDP_RATE.
[0069] Maintain a keepalive signal every 5 seconds on the control connection. If no keepalive response is received after 3 attempts, all connections are considered invalid. At this point, all connections are cleaned up and an error is reported to the application layer.
[0070] In the above embodiments, fountain codes generate random data packets at the sender through encoding and decoding algorithms. The receiver can recover the original data by collecting enough linearly independent data packets from the data stream. In network conditions such as weak networks, interference, and multipath transmission, fountain codes are an effective method to achieve reliable data transmission. This application proposes a TCP and UDP adaptive transmission method for time-varying network large transmission tasks, and proposes an algorithm to automatically adjust the TCP and UDP transmission modes according to the network transmission conditions to achieve more efficient data transmission.
[0071] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0072] This embodiment also provides an apparatus for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0073] Figure 5 This is a structural block diagram of a device for transmitting data blocks according to an embodiment of the present invention, such as... Figure 5 As shown, the device includes:
[0074] The first acquisition module 52 is used to acquire the current number of threads of the first transmission protocol and the transmission rate of the first transmission protocol to obtain the first number of threads and the first transmission rate.
[0075] The second acquisition module 54 is used to acquire the current number of threads of the second transmission protocol and the transmission rate of the second transmission protocol, so as to obtain the second number of threads and the second transmission rate.
[0076] The determining module 56 is used to determine the transmission protocol of the target data block based on the first number of threads and the first transmission rate, as well as the second number of threads and the second transmission rate.
[0077] The first transmission module 58 is configured to encode the target data block using a target encoding method when it is determined that the target data block will be transmitted via the second transmission protocol, and to transmit the encoded target data block via the second transmission protocol, wherein the reliability of the first transmission protocol is higher than that of the second transmission protocol.
[0078] The second transmission module is configured to transmit the target data block via the first transmission protocol if it is determined that the target data block will be transmitted via the first transmission protocol.
[0079] In an exemplary embodiment, the apparatus is further configured to determine whether the first thread count is zero; if the first thread count is zero, determine that the first transmission protocol transmits the target data block; if the first thread count is non-zero, determine whether the second thread count is zero; if the second thread count is zero, determine that the second transmission protocol transmits the target data block.
[0080] In an exemplary embodiment, the apparatus is further configured to determine whether the first transmission rate and the second transmission rate are equal when both the first number of threads and the second number of threads are non-zero; and to determine, when the first transmission rate and the second transmission rate are equal, to transmit the target data block using the transmission protocol with the smaller current number of threads.
[0081] In an exemplary embodiment, the apparatus is further configured to determine that the first transmission protocol transmits the target data block when the first transmission rate and the second transmission rate are equal and the first number of threads is less than or equal to the second number of threads; and to determine that the second transmission protocol transmits the target data block when the first transmission rate and the second transmission rate are equal and the first number of threads is greater than the second number of threads.
[0082] In an exemplary embodiment, the above-described apparatus is further configured to determine a transmission protocol with a higher transmission rate to transmit the target data block when both the first number of threads and the second number of threads are non-zero and the first transmission rate is not equal to the second transmission rate.
[0083] In an exemplary embodiment, the apparatus is further configured to, when it is determined that the target data block is transmitted via the first transmission protocol, increment the current thread count of the first transmission protocol by one; when the target data block is transmitted via the first transmission protocol, decrement the current thread count of the first transmission protocol by one, obtain the transmission rate of the target data block transmitted via the first transmission protocol, and obtain a third transmission rate; and update the transmission rate of the first transmission protocol to the third transmission rate.
[0084] In an exemplary embodiment, the apparatus is further configured to: increment the current thread count of the second transmission protocol by one when it is determined that the target data block is transmitted via the second transmission protocol; decrement the current thread count of the second transmission protocol by one when the encoded target data block is transmitted via the second transmission protocol, and obtain the transmission rate of the target data block transmitted via the second transmission protocol to obtain a fourth transmission rate; and update the transmission rate of the second transmission protocol to the fourth transmission rate.
[0085] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.
[0086] Embodiments of the present invention also provide a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of the method described in any of the preceding claims.
[0087] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0088] Embodiments of the present invention also provide an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.
[0089] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0090] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.
[0091] Embodiments of the present invention also provide a computer program product, including a computer program that, when executed by a processor, implements the steps of the methods described in various embodiments of the present application.
[0092] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those described herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0093] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for transmitting data, characterized in that, include: Obtain the current number of threads for the first transmission protocol and the transmission rate of the first transmission protocol to obtain the first number of threads and the first transmission rate; Obtain the current number of threads for the second transmission protocol and the transmission rate of the second transmission protocol to obtain the second number of threads and the second transmission rate; The transmission protocol for the target data block is determined based on the first number of threads and the first transmission rate, as well as the second number of threads and the second transmission rate. If it is determined that the target data block will be transmitted via the second transmission protocol, the target data block will be encoded using a target encoding method, and the encoded target data block will be transmitted via the second transmission protocol, wherein the reliability of the first transmission protocol is higher than that of the second transmission protocol. If it is determined that the target data block shall be transmitted via the first transmission protocol, the target data block shall be transmitted via the first transmission protocol.
2. The method according to claim 1, characterized in that, Determining the transmission protocol for the target data block based on the first number of threads and the first transmission rate, and the second number of threads and the second transmission rate, includes: Determine if the number of the first thread is zero; When the number of the first threads is zero, it is determined that the first transmission protocol transmits the target data block; If the number of the first thread is non-zero, determine whether the number of the second thread is zero; When the second thread count is zero, the second transmission protocol is used to transmit the target data block.
3. The method according to claim 1 or 2, characterized in that, The method for determining the transmission protocol of the target data block based on the first number of threads and the first transmission rate, as well as the second number of threads and the second transmission rate, further includes: If both the first number of threads and the second number of threads are non-zero, determine whether the first transmission rate and the second transmission rate are equal; When the first transmission rate and the second transmission rate are equal, the transmission protocol with the smaller current number of threads is determined to transmit the target data block.
4. The method according to claim 3, characterized in that, The method for determining the transmission protocol of the target data block based on the first number of threads and the first transmission rate, as well as the second number of threads and the second transmission rate, further includes: When both the first number of threads and the second number of threads are non-zero, and the first transmission rate is not equal to the second transmission rate, the transmission protocol with the larger transmission rate is determined to transmit the target data block.
5. The method according to claim 1, characterized in that, The method further includes: If it is determined that the target data block will be transmitted via the first transmission protocol, the current thread count of the first transmission protocol will be incremented by one. After the target data block has been transmitted through the first transmission protocol, the current thread count of the first transmission protocol is decremented by one, and the transmission rate of the target data block transmitted by the first transmission protocol is obtained to obtain the third transmission rate. Update the transmission rate of the first transmission protocol to the third transmission rate.
6. The method according to claim 1, characterized in that, The method further includes: If it is determined that the target data block will be transmitted via the second transmission protocol, the current thread count of the second transmission protocol will be incremented by one. After transmitting the encoded target data block via the second transmission protocol, the current thread count of the second transmission protocol is decremented by one, and the transmission rate of the target data block transmitted via the second transmission protocol is obtained to obtain the fourth transmission rate. Update the transmission rate of the second transmission protocol to the fourth transmission rate.
7. An apparatus for transmitting data blocks, characterized in that, include: The first acquisition module is used to acquire the current number of threads of the first transmission protocol and the transmission rate of the first transmission protocol, so as to obtain the first number of threads and the first transmission rate. The second acquisition module is used to acquire the current number of threads of the second transmission protocol and the transmission rate of the second transmission protocol, so as to obtain the second number of threads and the second transmission rate. The determining module is used to determine the transmission protocol of the target data block based on the first number of threads and the first transmission rate, as well as the second number of threads and the second transmission rate. A first transmission module is configured to, when it is determined that the target data block will be transmitted via the second transmission protocol, encode the target data block using a target encoding method and transmit the encoded target data block via the second transmission protocol, wherein the reliability of the first transmission protocol is higher than that of the second transmission protocol. The second transmission module is configured to transmit the target data block via the first transmission protocol if it is determined that the target data block will be transmitted via the first transmission protocol.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method described in any one of claims 1 to 7.
9. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the method as 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, it implements the steps of the method described in any one of claims 1 to 7.