Collaborative transmission method and transmission device based on UDP and TCP connections
10959125 ยท 2021-03-23
Assignee
Inventors
- Yeh-Kai Chou (Hsinchu County, TW)
- Cheng-Sheng Weng (Hsinchu, TW)
- Chi-Huang Shih (Taichung, TW)
- Bo-Sheng Chen (Taichung, TW)
Cpc classification
H04L47/196
ELECTRICITY
H04W28/0273
ELECTRICITY
H04L69/165
ELECTRICITY
International classification
Abstract
A collaborative transmission method and a transmission device based on UDP (User Datagram Protocol) and TCP (Transmission Control Protocol) connections are provided. The collaborative transmission method comprises: calculating a first rate and obtaining a first parameter, wherein the first rate is a rate using TCP to transmit packets and the first parameter is associated with the variation degree of the first rate; after obtaining the first rate, calculating a number of packets to be sent according to a target bit rate, the first parameter, the first rate, and a packet size, wherein the number of packets to be sent is the number of packets expected to be transmitted via UDP; and determining to use either UDP or TCP to send the packet according to a transmission flag and updating the number of packets to be sent when the packet number is not zero.
Claims
1. A collaborative transmission method based on UDP (User Datagram Protocol) and TCP (Transmission Control Protocol) comprising: calculating a first rate and obtaining a first parameter, wherein the first rate is a rate of transmitting packets via TCP and the first parameter is associated with a variation degree of the first rate; after calculating the first rate, calculating a number of packets to be sent according to a target transmission rate, the first parameter, the first rate, and a packet size, wherein the number of packets to be sent is a number of packets expected to be sent via UDP; and when the number of packets to be sent is not zero, determining whether to use either UDP or TCP to send a packet according to a transmission flag and updating the number of packets to be sent.
2. The collaborative transmission method based on UDP and TCP of claim 1, wherein the number of packets to be sent is calculated according to the following formula:
N.sub.UDP=(R.sub.TBR*AR.sub.TCP)P, wherein N.sub.UDP is the number of packets to be sent, R.sub.TBR is the target transmission rate, A is the first parameter, R.sub.TCP is the first rate and P is the packet size.
3. The collaborative transmission method based on UDP and TCP of claim 1, before sending the packet via UDP, further comprising: sending the packet via UDP after an interval time, wherein the interval time is calculated according to the following formula:
T.sub.interval=1/N.sub.UDP, wherein T.sub.interval is the interval time and N.sub.UDP is the number of packets to be sent.
4. The collaborative transmission method based on UDP and TCP of claim 3, wherein a step of determining whether to use either UDP or TCP to send a packet according to the transmission flag and updating the number of packets to be sent when the number of packets to be sent is not zero further comprising: activating a timer or keeping an activating state of the timer for calculating a cumulative time when the number of packets to be sent is not zero; and disabling the timer when the number of packets to be sent is zero.
5. The collaborative transmission method based on UDP and TCP of claim 4, further comprising: determining whether the cumulative time reaches the interval time after the timer is activated; wherein determining a state of the transmission flag when the cumulative time reaches the interval time; or calculating the cumulative time continuously by the timer when the cumulative time does not reach the interval time.
6. The collaborative transmission method based on UDP and TCP of claim 4, wherein the step of determining whether to use either UDP or TCP to send the packet according to a transmission flag and updating the number of packets to be sent when the number of packets to be sent is not zero further comprising: stopping transmitting the packet via UDP when the transmission flag is enabled; or transmitting the packet via UDP when the transmission flag is disabled.
7. The collaborative transmission method based on UDP and TCP of claim 1, wherein the step of determining whether to use either UDP or TCP to send the packet according to a transmission flag and updating the number of packets to be sent when the number of packets to be sent is not zero further comprising: enabling the transmission flag before a TCP packet is transmitted; and disabling the transmission flag when an acknowledge packet of TCP is received or the acknowledge packet of TCP is not received before a timeout.
8. The collaborative transmission method based on UDP and TCP of claim 1, wherein the first parameter represents an average rate of packet loss during a TCP transmission or during a TCP connection.
9. The collaborative transmission method based on UDP and TCP of claim 1, wherein the first rate is calculated according to the following formula:
R.sub.TCP=N.sub.TCP/(T.sub.currentT.sub.start), wherein R.sub.TCP is the first rate, N.sub.TCP is a total number of packets, T.sub.current is a current time, and T.sub.start is a starting time, the current time is the earliest time transmitting packets via TCP, and the total number of packets is a number of all packets transmitted from the starting time to the current time.
10. The collaborative transmission method based on UDP and TCP of claim 1, further comprising calculating the first rate and obtaining the first parameter when one of the following conditions is detected: a synchronization packet sent via TCP; a default period is passed; and an acknowledge packet returning via TCP is received.
11. A collaborative transmitter based on UDP and TCP comprising: a processing circuit configured to: obtain a first rate and a first parameter, wherein the first rate is a rate of transmitting packets via TCP and the first parameter is associated with a variation degree of the first rate; calculate the first rate and calculate a number of packets to be sent according to a target transmission rate, the first parameter, the first rate, and a packet size, wherein the number of packets to be sent is a number of packets expected to be sent via UDP; and determine whether to use UDP or TCP to send a packet according to a transmission flag and updating the number of packets to be sent when the number of packets to be sent is not zero.
12. The collaborative transmitter based on UDP and TCP of claim 11, wherein the processing circuit calculates the number of packets to be sent according to the following formula:
N.sub.UDP=(R.sub.TBR*AR.sub.TCP)/P, wherein N.sub.UDP is the number of packets to be sent, R.sub.TBR is the target transmission rate, A is the first parameter, R.sub.TCP is the first rate and P is the packet size.
13. The collaborative transmitter based on UDP and TCP of claim 11, wherein the processing circuit further calculates an interval time according to the following formula:
T.sub.interval=1/N.sub.UDP, wherein T.sub.interval is the interval time and N.sub.UDP is the number of packets to be sent; and the processing circuit further sends the packets via UDP after the interval time.
14. The collaborative transmitter based on UDP and TCP of claim 13, further comprising a timer electrically connecting to the processing circuit, wherein the timer is activated or keeps an activating state for calculating a cumulative time when the number of packets to be sent is not zero; and the timer is disabled to reset the cumulative time when the number of packets to be sent is zero.
15. The collaborative transmitter based on UDP and TCP of claim 14, wherein the processing circuit determines a state of the transmission flag when the cumulative time reaches the interval time.
16. The collaborative transmitter based on UDP and TCP of claim 14, wherein when the number of packets to be sent is not zero and the transmission flag is enabled, the processing circuit suspends transmitting the packet via UDP, or when the number of packets to be sent is not zero and the transmission flag is disabled, the processing circuit transmits the packet via UDP.
17. The collaborative transmitter based on UDP and TCP of claim 11, wherein the processing circuit enables the transmission flag before the processing circuit transmits the packet via TCP, when the processing circuit receives an acknowledgement packet corresponding to TCP before a timeout, the processing circuit disables the transmission flag.
18. The collaborative transmitter based on UDP and TCP of claim 11, wherein the first parameter represents an average rate of packet loss during a TCP transmission or during a TCP connection.
19. The collaborative transmitter based on UDP and TCP of claim 11, wherein the processing circuit calculates the first rate according to the following formula:
R.sub.TCP=N.sub.TCP/(T.sub.currentT.sub.start), wherein R.sub.TCP is the first rate, N.sub.TCP is a total number of packets, T.sub.current is a current time, and T.sub.start is a starting time, the current time is the earliest time transmitting packets via TCP, and the total number of packets is a number of all packets transmitted from the starting time to the current time.
20. The collaborative transmitter based on UDP and TCP of claim 14, wherein the processing circuit further calculates the first rate and obtains the first parameter when detecting one of the following conditions: the processing circuit sends a synchronization packet via TCP; the cumulative time calculated by the timer reaches a default period; and the processing circuit receives an acknowledge packet returning via TCP.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
(1) The present disclosure will become more fully understood from the detailed description given herein below and the accompanying drawings which are given by way of illustration only and thus are not limitative of the present disclosure and wherein:
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
(10)
DETAILED DESCRIPTION
(11) The detailed features and advantages of the present disclosure are described in detail below in the embodiments. The content is sufficient for any person who is skilled in the art to understand the technical content of the present disclosure and to implement accordingly. According to the disclosed contents, the claims and the drawings of this specification, a person who is skilled in the art may easily understand the purposes and advantages related to the present disclosure. The following embodiments are intended to describe the present disclosure in further detail, but are not intended to limit the scope of the present disclosure.
(12) The bandwidth configuration of the mobile network is set according to the number of bandwidth units and it depends on factors such as the number of users, the distance, and the moving speed. When a streaming video having a CBR (Constant-Bit-Rate) is transmitted via TCP (Transmission Control Protocol), the TCP transmission rate is limited by available bandwidth. When the available bandwidth is greater than CBR, the TCP transmission rate is limited by the CBR data amount available for transmission. Even if the TCP transmission rate keeps as same state as the CBR, it is still possible that packet loss happens due to wireless signal attenuation or network congestion.
(13) Please refer to
(14) Please refer to
(15) First, as shown in step S10, after the transmitter Tx established a TCP connection, an SYN (Synchronize Sequence Numbers) packet may be sent in step S12. Step S10 and step S12 can be operated in, for example, a network layer L1 of the OSI model (Open System Interconnection reference model).
(16) In an embodiment, after a trustworthy connection of three-way handshake is established, step S20-S26 can be operated in the application layer L2 of the OSI model. Please refer to step S20, calculating a current rate of TCP. In practical, the current rate of TCP can be calculated every fixed period, or the current rate of TCP can be updated every time a TPC packet is sent. The current rate of TCP can be calculated, for example, according to the following formula:
R.sub.TCP=N.sub.TCP/(T.sub.currentT.sub.start)(Formula 1).
(17) In Formula 1, R.sub.TCP is the current rate of TCP, N.sub.TCP is a total number of packets, T.sub.current is a current time, and T.sub.start is a starting time, while said current time is the earliest time transmitting packets via TCP. In an embodiment, the starting time T.sub.start may be adjusted in order to maintain immediacy when calculating the current rate of TCP. In practice, for example, the starting time T.sub.start is reset every interval time or returning to a slow start period of TCP. The total number of packets N.sub.TCP is a number of all packets transmitted from the starting time to the current time.
(18) Please refer to step S22, Calculating an expected rate of UDP. In an embodiment, the expected rate of UDP represents an insufficient part of the current rate of TCP compared to the available network bandwidth. Therefore, the expected rate of UDP is calculated, for example, according to the following formula:
R.sub.UDP=R.sub.TBR*AR.sub.TCP(Formula 2).
(19) In Formula 2, R.sub.UDP is the expected rate of UDP, A is a first parameter, R.sub.TBR is the target transmission rate, and R.sub.TCP is the current rate of TCP calculated in step S20. The unit of the aforementioned rates, for example, is kbps (kilobit per second). In an embodiment, the target bit rate is a target transmission rate/bandwidth for an application (such as a streaming video). For the convenience of description, the current rate of TCP, R.sub.TCP, simply referred to as the first rate, and the expected rate of UDP, R.sub.UDP, is simply referred to as the second rate.
(20) In an embodiment, the first parameter A represents as a variation degree of the first rate, which is an average rate of packet loss in the period of TCP transmission or in the period of TCP connection. For example, the first parameter A is set to 1 when the degree of variation of the first rate is greater than a first threshold while the first parameter A is set to 1.05-1.15 when the degree of variation of the first rate is less than or equal to the first threshold. In an embodiment, the setting of the first parameter A reflects the period of current TCP transmission and/or the average rate of packet loss of TCP connection. For example, please refer to
(21) Please refer to step S24, Activating or updating a UDP timer. In an embodiment, when the second rate R.sub.UDP is greater than zero, a UDP timer is activated or the UDP timer's activating state is kept for calculating a cumulative time. When the second rate R.sub.UDP is zero, the UDP timer is disabled. The UDP timer is to control an interval time between sending a UDP packet and sending the next UDP packet. Specifically, this interval time is calculated according to the following formulas:
T.sub.interval=1/N.sub.UDP(Formula 3),
N.sub.UDP=R.sub.UDP/P(Formula 4).
(22) In Formulas 3 and 4, T.sub.interval is the interval time, N.sub.UDP is the number of packets expected to be sent via UDP (in short, number of packets to be sent), and P is packet size. The unit of packet size is, for example, byte. According to the above formulas, when the current rate of TCP detected every period changes, the expected UDP transmission rate of step S22 and the UDP interval time of step S24 will be affected.
(23) According to formula 2 and formula 4, the formula to calculate the number of packets to be sent N.sub.UDP may be reformed as below:
N.sub.UDP=(R.sub.TBR*AR.sub.TCP)/P(formula 5).
(24) Please refer to step S26, Performing a packet scheduling. This step is to determine whether to use either UDP or TCP to send a packet, and the detail of this step will be described in
(25) Please refer to steps S30-S36 performed in the receiver Rx. Specifically, the transmitter Tx determines to use either TCP or UDP to send a packet after step S26 is performed. After receiving this packet (step S30), the receiver Rx determines the source of the packet (step S32), records packet sent via TCP (step S34) and packet sent via UDP (step S35) respectively. As described above, if the current packet is sent via TCP, the receiver Rx returns an ACK (acknowledgment) packet to the transmitter Tx, and then the transmitter Tx performs step S20 again to update the current rate of TCP after receiving this ACK packet.
(26) Please refer to
(27) Please refer to
(28) Please refer to step S56, calculating a number of packets to be sent N.sub.UDP. In an embodiment, before calculating the number of packets to be sent N.sub.UDP, the second rate R.sub.UDP, which is the rate expected to transmit packet via UDP, may be calculated first according to the target transmission rate R.sub.TBR, the first parameter A, and the first rate R.sub.TCP, with the reference of formula 2. The number of packets to be sent N.sub.UDP is a number of packets expected to be transmitted via UDP and is determined by the packet size P and the second rate R.sub.UDP as shown in formula 4.
(29) Please refer to step S58, determining whether the number of packets to be sent is not zero. If the number of packets to be sent N.sub.UDP is not zero, the next step is S60. If the number of packets to be sent N.sub.UDP is zero, the next step is S54. In an embodiment, if the current rate R.sub.TCP of TCP has not reached the target transmission rate R.sub.TBR (or the target transmission rate R.sub.TBR*A) yet, the number of packets to be sent N.sub.UDP is determined to be not zero, and thus the next step is S60. If the current rate R.sub.TCP of TCP has reached the target transmission rate R.sub.TBR (or the target transmission rate R.sub.TBR*A), the number of packets to be sent N.sub.UDP is determined to be zero, and then step S54 is performed to wait for updating the first rate R.sub.TCP next time.
(30) Please refer to step S60, calculating a cumulative time. In this step, a timer is activated or an activating state of the timer is maintained for calculating a cumulative time. As described above, the timer is disabled when the number of packets to be sent is determined to be zero in step S58 and step S54 is performed next.
(31) Please refer to step S62, determining whether the cumulative time reaches the interval time. In an embodiment, the interval time T.sub.interval for sending UDP packets is calculated according to the number of packets to be sent N.sub.UDP, as shown in formula 3. After the timer is activated, step S62 determines whether the cumulative time calculated by the timer reaches the interval time T.sub.interval. When the cumulative time reaches the interval time T.sub.interval, the next step is S64. Otherwise, the process returns to step S60 to calculate the cumulative time continuously.
(32) Please refer to step S64, determining whether the transmission flag is enabled. In an embodiment, the transmission flag is used to represent whether a TCP packet is transmitting currently. Please refer to step S64 and
(33)
(34) Please refer to
(35) In an embodiment, the computing unit 84 further calculates the number of packets to be sent N.sub.UDP according to formula 4 and calculates the interval time T.sub.interval according to formula 3. The communicating unit 86 further sends the packet via UDP after the interval time T.sub.interval.
(36) In an embodiment, the collaborative transmission device 8 based on UDP and TCP further comprises a timer (not depicted). The timer electrically connects to the computing unit 84 and a communicating unit 86, wherein the timer is activated or keeps an activating state for calculating a cumulative time when the number of packets to be sent N.sub.UDP is not zero; and the timer is disabled to reset the cumulative time when the number of packets to be sent N.sub.UDP is zero. The computing unit 84 further determines the state of the transmission flag when the cumulative time reaches the interval time T.sub.interval. The computing unit 84 further controls the communication unit 86 to stop sending packets via UDP when the number of packets to be sent N.sub.UDP is not zero and the transmission flag is enabled, or controls the communication unit 86 to send packets via UDP when the number of packets to be sent N.sub.UDP is not zero and the transmission flag is disabled.
(37) In an embodiment, the computing unit 84 further enables the transmission flag before the communicating unit sends the packet via TCP; and disables the transmission flag when the communicating unit 86 receives the ACK packet or when timeout occurs and the communication unit 86 does not receive the ACK packet.
(38) In an embodiment, the computing unit 84 further calculates the first rate R.sub.TCP according to formula 1.
(39) In an embodiment, the computing unit 84 further calculates the first rate R.sub.TCP and obtains the first parameter A when detecting one of the following conditions: the communicating unit 86 sends a synchronization packet via TCP; the cumulative time calculated by the timer reaches a default period; and the communicating unit 86 receives an acknowledge packet returning via TCP.
(40) In an embodiment, the detecting unit 82, the computing unit, and the communicating unit 86 may be hardware, firmware, or executable software or program code stored in the memory, loaded and executed by the microprocessor or digital signal processor. If the above devices are implemented by hardware, the detecting unit 82, the computing unit 84 and/or the communicating unit 86 may be implemented by a single integrated chip or by a plurality of circuits/chips, and the present disclosure does not limit thereof. The circuits/chips or single integrated chips described above may use ASICs (Application-Specific Integrated Circuit) or an FPGAs (Field Programmable Gate Array) to implement. The memory described above is, for example, random access memory, read-only memory or flash memory, etc. In an embodiment, the communicating unit 86 includes a device supporting wired network, wireless network, mobile network and/or wireless communications. In an embodiment, the transmission device comprises a processing circuit configured to perform functions of the detecting unit 82, the computing unit 84 and/or the communicating unit 86. The processing circuit may be implemented using a microcontroller, a microprocessor, a processor, a CPU (Central Processing Unit), a DSP (Digital Signal Processor), an ASIC, a digital logical circuit, an FPGA, and/or other hardware components with computing/processing functions. In an embodiment, the transmission device 8 may be a mobile phone, a PDA (Personal Digital Assistant) a tablet computer, a laptop, a portable media player, a digital camera, a VR (Virtual Reality) and an AR (Augmented Reality) wearing device, etc.
(41) Please refer to
(42)
(43) Please refer to
(44) For a precise description of the effects of the collaborative transmission method based on UDP and TCP according to an embodiment of the present disclosure. Please refer to the following formula, where L is a bandwidth ratio that has not yet reached the target transmission rate.
(45)
(46) In Formula 6, T is the time needed to reach the target transmission rate, t is the current time (starting from the 0.sup.th second), R is the data transmission rate to reach the target transmission rate, r is the current rate every 0.01 second, and N is the number of statistics (which is (Tt)/0.01).
(47) TABLE-US-00001 TABLE 1 the performance of packet loss at every time interval on the basis of TCP transmission. Time interval L value (%) T value (second) Slow start 52.01 0.73 5-10 second 16.77 14.82 20-25 second 3.72 28.47 35-40 second 2.46 43.69
(48) Please refer to Table 1, during the time interval from 5-10 second of the period of congestion avoidance, the bandwidth ratio that has not yet reached the target transmission rate is 16.77%. In addition, when calculating from the 5.sup.th second, the time to recover to the target transmission rate (500 kbps) is 14.82 seconds.
(49) TABLE-US-00002 TABLE 2 the performance of packet loss at every time interval on the basis of the collaborative transmission method based on UDP and TCP. Time interval L value (%) T value (second) Slow start 5.41 0.18 5-10 second 0.25 11.95 20-25 second 0 25 35-40 second 0 40
(50) Please refer to Table 2. In the time interval from 5.sup.th second till 10.sup.th second of the period of congestion avoidance, the bandwidth ratio that has not yet reached the target transmission rate is 0.25%. In addition, counting from the 5.sup.th second, the time to recover to the target transmission rate (500 kbps) is 11.95 seconds. In view of the above Tables 1 and 2, regarding the bandwidth ratio that has not yet reached the target transmission rate, in comparison with that of the collaborative transmission method based on UDP and TCP according to an embodiment of the present disclosure, said bandwidth ratio of the conventional transmission method via TCP only is 67 times thereof (16.77/0.25=67.08). Furthermore, regarding the recovering time to the target transmission rate, in comparison with that of the collaborative transmission method based on UDP and TCP according to an embodiment of the present disclosure, said recovering time of the transmission method via TCP only is 1.24 times thereof (14.82/11.95=1.24).
(51) Furthermore, during the period of slow start, as shown in Table 1, it costs 0.73 seconds to reach the target transmission rate via TCP transmission only, and the value of L is 52.01%. According to Table 2, the collaborative transmission method based on UDP and TCP according to an embodiment of the present disclosure costs 0.18 seconds to reach the target transmission rate, and the value of L is 5.41%. In summary, the time to recover to the target transmission rate of the present disclosure is 4 times faster than the conventional method (0.73/0.18=4.05), and the bandwidth ratio to reach the target transmission rate differs by 9.5 times above (52.04/5.41=9.61).
(52) Through the above presentation of numbers, it is obvious that the collaborative transmission method based on UDP and TCP according to an embodiment of the present disclosure can effectively use the UDP packet to compensate insufficient part of TCP transmission. In an embodiment of the present disclosure, when the available bandwidth is smaller than the expected target transmission rate, the transmission bandwidth may be as close as possible to the available bandwidth by the present disclosure. In this embodiment, the aforementioned target transmission rate R.sub.TBR may be the available bandwidth. When the available bandwidth is greater than the expected target transmission rate, the transmission bandwidth may be as close as possible to the expected target transmission rate. In this embodiment, the aforementioned R.sub.TBR may be the expected target transmission rate.
(53) In view of the above description, the main concept of the collaborative transmission method based on UDP and TCP according to an embodiment of the present disclosure is to use UDP to try to improve the performance of TCP transmission in the mobile network or the wireless network. Because the TCP transmission has the characteristic of slow rise and rapid fall (as jagged part in the diagram), the transmission characteristics of UDP packets can be utilized to maintain the current transmission rate or moderately competing for a higher transmission rate when the TCP speed is lowered. Furthermore, using UDP immediately to assist TCP transmission to ensure the maximum transmission bit rate and achieve the demand for high quality transmission of images.
(54) The method proposed by the present disclosure can determine the timing that there is available bandwidth with relatively small impact on the TCP, and then using UDP to help maintain the transmission rate at a level that satisfies the target transmission rate (for example, as close as possible to the available bandwidth or the expected target transmission rate), thereby improving the video transmission quality under the wireless network, and achieving a high-quality transmission of the application such as aerial photography by UAVs.