Search

CN-122027718-A - Method and device for transmitting data

CN122027718ACN 122027718 ACN122027718 ACN 122027718ACN-122027718-A

Abstract

The embodiment of the invention provides a method and a device for transmitting data, which comprise the steps of obtaining the current thread number of a first transmission protocol and the transmission rate of the first transmission protocol to obtain the first thread number and the first transmission rate, obtaining the current thread number of a second transmission protocol and the transmission rate of the second transmission protocol to obtain the second thread number and the second transmission rate, determining the transmission protocol for transmitting a target data block according to the first thread number and the first transmission rate and the second thread number and the second transmission rate, encoding the target data block in a target encoding mode under the condition that the target data block is determined to be transmitted through the second transmission protocol, transmitting the encoded target data block through the second transmission protocol, wherein the reliability of the first transmission protocol is higher than that of the second transmission protocol, and transmitting the target data block through the first transmission protocol under the condition that the target data block is determined to be transmitted through the first transmission protocol. The invention solves the problem of data transmission errors caused by adopting a single transmission protocol.

Inventors

  • LI GUO
  • Weng Hongjian
  • ZHAO ZHI
  • Xue Yuanxing
  • Duan Qiaoman

Assignees

  • 中国星网网络应用研究院有限公司

Dates

Publication Date
20260512
Application Date
20241111

Claims (10)

  1. 1. A method of transmitting data, comprising: acquiring the current thread number of a first transmission protocol and the transmission rate of the first transmission protocol to obtain the first thread number and the first transmission rate; acquiring the current thread number of a second transmission protocol and the transmission rate of the second transmission protocol to obtain a second thread number and a second transmission rate; determining a transmission protocol of a transmission target data block according to the first thread number and the first transmission rate, and the second thread number and the second transmission rate; Under the condition that the target data block is transmitted through the second transmission protocol, encoding the target data block through a target encoding mode, and transmitting the encoded target data block through the second transmission protocol, wherein the reliability of a first transmission protocol is higher than that of the second transmission protocol; In the case that the target data block is determined to be transmitted through the first transmission protocol, the target data block is transmitted through the first transmission protocol.
  2. 2. The method of claim 1, wherein 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, comprises: judging whether the first thread number is zero; Determining that the first transmission protocol transmits the target data block under the condition that the first thread number is zero; Judging whether the second thread number is zero or not under the condition that the first thread number is non-zero; and determining that the second transmission protocol transmits the target data block under the condition that the second thread number is zero.
  3. 3. The method according to claim 1 or 2, wherein 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, further comprises: Judging whether the first transmission rate and the second transmission rate are equal or not under the condition that the first thread number and the second thread number are non-zero; And under the condition that the first transmission rate and the second transmission rate are equal, determining a transmission protocol with a smaller current thread number to transmit the target data block.
  4. 4. The method of claim 3, wherein 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, further comprises: And determining a transmission protocol with a larger transmission rate to transmit the target data block under the condition that the first thread number and the second thread number are non-zero and the first transmission rate is not equal to the second transmission rate.
  5. 5. The method according to claim 1, wherein the method further comprises: Performing an add operation on a current thread number of the first transport protocol in case it is determined that the target data block is transported via the first transport protocol; Under the condition that the target data block is transmitted through the first transmission protocol, performing one subtracting operation on the current thread number of the first transmission protocol, and acquiring the transmission rate of the first transmission protocol for transmitting the target data block to obtain a third transmission rate; updating the transmission rate of the first transmission protocol to the third transmission rate.
  6. 6. The method according to claim 1, wherein the method further comprises: Executing an addition operation on the current thread number of the second transmission protocol under the condition that the target data block is determined to be transmitted through the second transmission protocol; Under the condition that the coded target data block is transmitted through the second transmission protocol, performing one subtracting operation on the current thread number of the second transmission protocol, and acquiring the transmission rate of the second transmission protocol for transmitting the target data block to obtain a fourth transmission rate; updating the transmission rate of the second transmission protocol to the fourth transmission rate.
  7. 7. An apparatus for transmitting a block of data, comprising: the first acquisition module is used for acquiring the current thread number of the first transmission protocol and the transmission rate of the first transmission protocol to obtain the first thread number and the first transmission rate; The second acquisition module is used for acquiring the current thread number of the second transmission protocol and the transmission rate of the second transmission protocol to obtain the second thread number and the second transmission rate; A determining module, configured to determine a transmission protocol of a transmission target data block according to the first thread number and the first transmission rate, and the second thread number and the second transmission rate; The first transmission module is used for encoding the target data block in a target encoding mode under the condition that the target data block is transmitted through the second transmission protocol, and transmitting the encoded target data block through the second transmission protocol, wherein the reliability of the first transmission protocol is higher than that of the second transmission protocol; And the second transmission module is used for transmitting the target data block through the first transmission protocol under the condition that the target data block is determined to be transmitted through the first transmission protocol.
  8. 8. A computer readable storage medium, characterized in that a computer program is stored in the computer readable storage medium, wherein the computer program, when being executed by a processor, implements the steps of the method according to any of the claims 1 to 7.
  9. 9. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to run the computer program to perform the method of any of the claims 1 to 7.
  10. 10. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method as claimed in any one of claims 1 to 7.

Description

Method and device for transmitting data Technical Field The embodiment of the invention relates to the field of communication, in particular to a method and a device for transmitting data. Background When a transmission control protocol (Transmission Control Protocol, TCP for short) and a user datagram protocol (User Datagram Protocol, UDP for short) face large transmission tasks, the TCP is used as a reliable transmission protocol, and can efficiently realize complete data transmission under the condition of stable network links, but in a weak network environment, the congestion control and accumulated response mechanisms of the TCP can lead to the reduction of transmission throughput due to higher packet loss rate of network transmission, so that the performance of the TCP in the network environment is greatly reduced. The transmission rate of UDP is faster than that of TCP in a weak network environment, but UDP is unreliable, and problems such as data loss, repetition, and disorder may occur. TCP transport and UDP transport each have advantages and disadvantages for different network transport scenarios. In a Time-varying network environment such as Round-Trip Time (RTT) and packet loss rate, which are oriented to the network, if a single transmission protocol is adopted, there are corresponding drawbacks, and a problem of data transmission errors occurs. There is currently no effective solution to the above problems. Disclosure of Invention The embodiment of the invention provides a method and a device for transmitting data, which at least solve the problem of data transmission errors caused by adopting a single transmission protocol in the related art. According to one embodiment of the invention, a method for transmitting data is provided, which comprises the steps of obtaining the current thread number of a first transmission protocol and the transmission rate of the first transmission protocol to obtain the first thread number and the first transmission rate, obtaining the current thread number of a second transmission protocol and the transmission rate of the second transmission protocol to obtain the second thread number and the second transmission rate, determining the transmission protocol for transmitting a target data block according to the first thread number and the first transmission rate and the second thread number and the second transmission rate, encoding the target data block through a target encoding mode under the condition that the target data block is determined to be transmitted through the second transmission protocol, and transmitting the encoded target data block through the second transmission protocol, wherein the reliability of the first transmission protocol is higher than that of the second transmission protocol, and transmitting the target data block through the first transmission protocol under the condition that the target data block is determined to be transmitted through the first transmission protocol. In one exemplary embodiment, determining a transmission protocol for transmitting a target data block according to the first thread number and the first transmission rate, and the second thread number and the second transmission rate includes determining whether the first thread number is zero, determining that the first transmission protocol transmits the target data block if the first thread number is zero, determining whether the second thread number is zero if the first thread number is non-zero, and determining that the second transmission protocol transmits the target data block if the second thread number is zero. In an exemplary embodiment, determining a transmission protocol for transmitting a target data block according to the first thread number and the first transmission rate, and the second thread number and the second transmission rate, further includes determining whether the first transmission rate and the second transmission rate are equal if the first thread number and the second thread number are both non-zero, and determining a transmission protocol with a smaller current thread number to transmit the target data block if the first transmission rate and the second transmission rate are equal. In one exemplary embodiment, determining that a transmission protocol having a smaller current thread number transmits the target data block when the first transmission rate and the second transmission rate are equal includes determining 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 thread number is less than or equal to the second thread number, and determining 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 thread number is greater than the second thread number. In an exemplary embodiment, determining a transmission protocol for transmitt