Invention content
The present invention provides a kind of method and terminal that packet loss retransmits, and solves and is lost in the prior art since terminal is repeatedly sent
Packet retransmission request and so that packet loss of packet loss transmitting terminal pair is repeated several times and send, to cause network bandwidth insufficient, influence net
The problem of speed of network transmission data, to solve the above-mentioned problems, the present invention, use following technical scheme:
A kind of terminal, including:
Time computing module, the time for calculating the retransmission request for sending same packet loss apart from last time;
Time comparison module, for carrying out the time computing module obtained time and Network Transmission Delays time
Compare;
Packet loss retransmits judgment module, for judging whether the result that the time comparison module obtains is to be sent apart from last time
The time of the retransmission request of same packet loss is more than the Network Transmission Delays time, if so, sending the re-transmission of the packet loss again
Request.
Further, the packet loss re-transmission judgment module further includes:If it is not, not sending retransmission request then.
Further, the time computing module specifically includes:
Submodule is arranged in flag bit, corresponds to a flag bit for packet loss to be arranged, the initial value of flag bit is 0;
Indicate bitwise operator module, if being reached for preset interval time, the corresponding flag bit of packet loss is carried out plus 1 transports
It calculates;
Flag bit judging submodule, whether the value for judgement symbol position is 1, if so, directly transmitting the packet loss
Retransmission request;
Time computational submodule calculates institute when for being no according to the judging result in the flag bit judging submodule
The time for stating the retransmission request for sending same packet loss apart from last time is:After the value of flag bit subtracts 1, multiplied by with the predetermined interval
Time.
The packet loss retransmits judgment module and is additionally operable to the flag bit corresponding to the packet loss that will need to send retransmission request again
Value be set to 1.
Further, further include Network Transmission Delays time computing module, arrived specifically for sending network delay detection packet
Packet loss transmitting terminal, it is that the network transmission is prolonged to the feedback time of network delay detection packet to calculate the packet loss transmitting terminal
The slow time.
A kind of method that packet loss retransmits, including:
Calculate the time for the retransmission request that same packet loss was sent apart from last time;
The time of the retransmission request that same packet loss was sent apart from last time is compared with the Network Transmission Delays time;
Judge whether the time of the retransmission request that same packet loss was sent apart from last time is more than the Network Transmission Delays
Time, if so, sending the retransmission request of the packet loss again.
Further, further include:If it is not, not sending retransmission request then.
Further, the time for calculating the retransmission request for sending same packet loss apart from last time specifically includes:
Packet loss is set and corresponds to a flag bit, the initial value of flag bit is 0;
If preset interval time reaches, add-one operation is carried out to the corresponding flag bit of packet loss;
Whether the value of judgement symbol position is 1, if so, directly transmitting the retransmission request of the packet loss;If it is not, then it is described away from
Time from the retransmission request that last time sends same packet loss is:After the value of flag bit subtracts 1, when multiplied by with the predetermined interval
Between;
Further include after the retransmission request for sending the packet loss again:The value of flag bit corresponding to the packet loss is set
It is 1.
Further, the Network Transmission Delays time computational methods include:Network delay detection packet is sent to send out to packet loss
Sending end, it is the network-induced delay to the feedback time of network delay detection packet to calculate the packet loss transmitting terminal.
The present invention provides the method and terminal that a kind of packet loss retransmits, and the terminal includes comparing time computing module, time
Module and packet loss retransmit judgment module, these modules enable the terminal to send same packet loss apart from last time according to what is calculated
After the time of retransmission request is compared with the Network Transmission Delays time, when the re-transmission for sending same packet loss apart from last time is asked
When the time asked is more than the Network Transmission Delays time, obtains the packet loss and need to send retransmission request.This programme makes terminal not
Can retransmission request blindly only be sent to each packet loss, but selectively send the retransmission request of packet loss so that in data
The case where packet loss will not occur in the transmission process of packet repeatedly to retransmit, occupy data channel, the transmission of such network data will
It is more quick, unimpeded, simultaneously because the real-time of data application is greatly improved, increase the experience of user.
Specific implementation mode
Below by specific implementation mode combination attached drawing, invention is further described in detail.
It is as shown in Figure 1 a kind of structure chart of terminal shown in one embodiment of the invention, refers to Fig. 1, the terminal 100
Including:Time computing module 101, time comparison module 102 and packet loss retransmit judgment module 103;Time computing module 101 is used
In the time for calculating the retransmission request for sending same packet loss apart from last time;Time comparison module 102, for calculating the time
The 101 obtained time of module is compared with the Network Transmission Delays time;Packet loss retransmits judgment module 103, for judging
State whether result that time comparison module obtains is time of the retransmission request for sending same packet loss apart from last time to be more than the net
The network propagation delay time, if so, sending the retransmission request of the packet loss again.Due to network during network data transmission
Data-bag lost is generated there is a situation where local fault or congestion, lost data packet is the packet loss;It is described heavy
It passes request and retransmits primary request to the packet loss for request packet loss transmitting terminal;The network-induced delay is to indicate to exist at this time
The back and forth transmission required time of a data packet is carried out in network;If sending the retransmission request of same packet loss apart from last time
Time is more than the Network Transmission Delays time, then showing the packet loss, there are no receipts after more than the Network Transmission Delays time
It arrives, i.e., this packet loss retransmitted is lost again in network transmission, and therefore, the packet loss needs to send retransmission request again;Institute
It includes the equipment with network transmission function such as computer, mobile phone, tablet computer to state terminal 100.
In some embodiments, the packet loss retransmits judgment module 103, for judging what the time comparison module obtained
As a result whether be apart from last time send same packet loss retransmission request time be more than the Network Transmission Delays time, if it is not,
Retransmission request is not sent then.If the time for sending the retransmission request of same packet loss apart from last time passes less than or equal to the network
Defeated delay time illustrates to be received not yet to the reason of re-transmission of this packet loss is because of network delay, then in this packet loss weight
Pass request in there is no need to this packet loss send retransmission request, avoid excessively repeat to packet loss transmitting terminal send packet loss retransmit
Request, reduces transmission times of the packet loss transmitting terminal to the packet loss, to reduce the waste of bandwidth, improves the effect of re-transmission
Rate.
In some embodiments, the time computing module 101 specifically includes:Submodule 1011 is arranged in flag bit, is used for
Packet loss is set and corresponds to a flag bit, the initial value of flag bit is 0;Indicate bitwise operator module 1012, if being used for predetermined interval
Time reaches, then carries out add-one operation to the corresponding flag bit of packet loss;Flag bit judging submodule 1013 is used for judgement symbol position
Value whether be 1, if so, directly transmitting the retransmission request of the packet loss;Time computational submodule 1014, for according to
When judging result in flag bit judging submodule is no, calculate the retransmission request that same packet loss was sent apart from last time when
Between be:After the value of flag bit subtracts 1, multiplied by with the preset interval time.The flag bit be it is simultaneous with packet loss,
Value range is integer, and what initial value indicated is when often detecting a packet loss, and the value of the corresponding flag bit of the packet loss is set
It is 0;The preset interval time be the terminal 100 detect every time its packet loss whether need send retransmission request interval when
Between, i.e., each preset interval time arrives, and whether terminal 100 can all be detected its packet loss needs to send retransmission request;If
The result that the time computational submodule 1014 calculates is more than the Network Transmission Delays time, then its corresponding packet loss needs to send weight
Pass request;If flag bit value is 1, indicates the packet loss that the corresponding packet loss of this flag bit is new, is not transmitted across retransmission request,
Therefore it needs to send retransmission request.
In further embodiments, the packet loss retransmits judgment module 103 and is additionally operable to need to send retransmission request again
Packet loss corresponding to the value of flag bit be set to 1.It will need the corresponding flag bit value of the packet loss for sending retransmission request again
It is set to 1 and is in order to more convenient when next preset interval time arrives, calculate the packet loss and send retransmission request apart from last time
Time.
In further embodiments, the terminal 100 further includes Network Transmission Delays time computing module, is specifically used for hair
SCN Space Cable Network delay detection packet arrives packet loss transmitting terminal, calculates feedback time of the packet loss transmitting terminal to network delay detection packet
The as described Network Transmission Delays time.It is that terminal 100 sends network delay detection packet to packet loss transmitting terminal, packet loss transmitting terminal
Network delay response bag is responded immediately after receiving network delay detection packet, after terminal 100 receives network delay response bag, is calculated
It receives network delay response bag and sends the time difference of network delay detection packet, this time difference is Network Transmission Delays at this time
Time.Further, in order to more accurately calculate the Network Transmission Delays time, terminal 100 can repeatedly send detection packet and arrive
Packet loss transmitting terminal calculates time difference, then the mode averaged to calculate the Network Transmission Delays time;In addition, due to it is each when
The network state of section differs, and therefore, the Network Transmission Delays time needs to calculate at regular intervals primary.
Terminal provided in this embodiment, can selectively send packet loss retransmission request, and such packet loss transmitting terminal is just not
One packet loss can be repeated several times and be sent so that the transmission of network data will not occupy more channels, to network transmission number
According to more quick.
As shown in figure 3, for the method flow diagram that a kind of packet loss retransmits shown in another embodiment of the present invention.Fig. 3 is referred to,
After the method that the packet loss retransmits starts,
S301:Calculate the time that same packet loss retransmission request was sent apart from last time.During network data transmission by
Data-bag lost is generated there is a situation where local fault or congestion in network, lost data packet is the packet loss;
The retransmission request is that request packet loss transmitting terminal retransmits the packet loss primary request;Same packet loss was sent apart from last time
The time specific computational methods of retransmission request can be:Packet loss is set and corresponds to a flag bit, the initial value of flag bit is 0;
If preset interval time reaches, add-one operation is carried out to the corresponding flag bit of packet loss;It is lost according to the determination of the value of the flag bit
Wrap the time that retransmission request was sent apart from last time.The flag bit is simultaneous with packet loss, and value range is integer,
What initial value indicated is when often detecting a packet loss, and the value of the flag bit of the packet loss is set to 0;The preset interval time is
The terminal detects whether its packet loss needs to send the interval time of retransmission request every time, i.e., each preset interval time arrives,
Flag bit add 1 operation, and whether then terminal can all be detected its packet loss needs to send retransmission request;By flag bit
Value subtract 1 after, multiplied by with the preset interval time, can obtain the packet loss apart from last time send retransmission request when
Between.
S302:The time of the retransmission request that same packet loss was sent apart from last time and Network Transmission Delays time are carried out
Compare.The Network Transmission Delays time is the back and forth transmission required time for indicating to carry out a data packet in a network;
Its computational methods can be:It sends network delay detection packet and arrives packet loss transmitting terminal, calculate the packet loss transmitting terminal to the network
The feedback time of delay detection packet is the Network Transmission Delays time.Specifically, it sends network delay detection packet and arrives packet loss
Transmitting terminal, packet loss transmitting terminal respond network delay response bag after receiving network delay detection packet, receive network delay and answer immediately
The time difference for receiving network delay response bag and sending network delay detection packet is calculated after answering packet, this time difference is net at this time
The network propagation delay time.Further, in order to more accurately calculate the Network Transmission Delays time, detection packet can repeatedly be sent
To packet loss transmitting terminal, the time difference is calculated, then the mode averaged calculates the Network Transmission Delays time;In addition, due to each
The network state of period differs, and therefore, the Network Transmission Delays time needs to calculate at regular intervals primary.
S303:When whether sending the time of the retransmission request of same packet loss apart from last time more than the Network Transmission Delays
Between, if so, S304 is executed, if it is not, then executing S305.
S304:The retransmission request of the packet loss is sent again.Because at this point, the packet loss is when more than Network Transmission Delays
Between after receive not yet, i.e., this retransmit packet loss in network transmission again be lost, therefore, the packet loss needs to send again
Retransmission request.
S305:The retransmission request of the packet loss is not sent.At this point, the re-transmission to this packet loss is received not yet, for no other reason than that net
The reason of network postpones.There is no need to send retransmission request to this packet loss so in this packet loss retransmission request, avoid excessive
What is repeated improves the efficiency of re-transmission to packet loss transmitting terminal transmission packet loss retransmission request to reduce the waste of bandwidth.
The method that packet loss provided in this embodiment retransmits is screened according to the time calculated apart from last time transmission retransmission request
Whether packet loss needs to send retransmission request, avoids the excessive number for sending retransmission request and is carried to reduce the waste of bandwidth
The high efficiency of network data transmission.
In addition, in practical applications, existing for often multiple packet losses and the mode deposited, for being lost there are multiple in terminal
Bao Shi, the packet loss will exist in the form of packet loss array in the terminal.The generation process of the packet loss array is:It receives new
Data packet after, judge whether the new data packet is the packet loss retransmitted, if so, this packet is rejected in packet loss array;If
It is no, then it detects the data packet and whether there is packet loss, if there are new packet loss, new packet loss is added in packet loss array, and will
The corresponding mark position of packet loss is 0.At this point, the method that its packet loss retransmits is specially:As shown in figure 4, for another implementation of the present invention
A kind of method flow diagram that packet loss retransmits shown in example.Fig. 4 is referred to, after the method which retransmits starts,
S401:Preset interval time reaches.The preset interval time is to detect whether its packet loss needs to send weight every time
Pass the interval time of request.
S402:Add-one operation is carried out to the corresponding flag bit of packet loss.If the value of flag bit is 0 at this time, carries out plus 1 transports
After calculation, the value of the flag bit is 1;If the value of flag bit is 1 at this time, after carrying out add-one operation, the value of the flag bit is
2。
S403:Judge whether packet loss respective flag position is 1, if so, executing S405;If it is not, then executing S404.
S404:When whether time of the corresponding packet loss in calculation flag position apart from last time retransmission request is more than Network Transmission Delays
Between, if so, executing, S405;If it is not, then terminating this operation.The time of the retransmission request of same packet loss was sent apart from last time
Calculating process be:After subtracting 1 by the value of flag bit, multiplied by with the preset interval time;The Network Transmission Delays time
Computational methods be send network delay detection packet arrive transmitting terminal;It calculates and receives the network delay response bag that the transmitting terminal is sent
With the time difference for sending network delay detection packet, the time difference is the Network Transmission Delays time at this time.
S405:Send the retransmission request of the packet loss.Because if the corresponding flag bit of packet loss is 1, then it represents that this packet loss is one
A new packet loss, so needing to send retransmission request;If time of the packet loss apart from last time retransmission request prolongs more than network transmission
The slow time, then it represents that this packet loss is more than there are no receiving, i.e., this packet loss retransmitted is in network transmission after the Network Transmission Delays time
In again be lost, therefore, the packet loss need send retransmission request.
S406:The corresponding flag bit value of packet loss is set to 1.It is in order to more convenient in this way in next preset interval time
When arrival, the time of the retransmission request that same packet loss was sent apart from last time is calculated.
It can be in the case where significantly reducing the circumstances for retransmitting bandwidth using the method that the packet loss of the present invention retransmits, while ensureing to losing
Timely retransmission request is wrapped, especially in the case where the bigger packet loss of network delay is relatively high.Assuming that current network packet loss
Rate is 20%, assuming that the Network Packet Loss retransmitted is no longer lost ideally, then the bandwidth of 1 unit of transmission just needs
The additional packet loss for retransmitting 1x20%=0.2 retransmits bandwidth, so total bandwidth is 1+0.2=1.2.If network delay is at this time
100ms, in order to ensure low latency, the preset interval time that packet loss retransmits is set as 20ms (is for the video of 50 frames/second
The delay time of one frame image), if without using the method that packet loss of the present invention retransmits, to same packet loss in this 100ms
Retransmission request can send 100/20=5 time, it is 5x0.2=1 that the additional packet loss of generation, which retransmits bandwidth, and such total bandwidth is 1+1=2,
This is higher by (2-1.2)/1.2, about 66% than the bandwidth usage amount 1.2 that above-mentioned ideal situation needs, if using packet loss of the present invention
The method of re-transmission, it is ensured that a retransmission request is only sent out to same packet loss in 100ms, the re-transmission bandwidth generated in this way and
As the bandwidth usage amount 1.2 that above-mentioned ideal situation needs, this is equivalent to than having saved (2- without using the method for the present invention
1.2) bandwidth usage amount/2=40%.
The method that packet loss provided in this embodiment retransmits, is mainly characterized by, and selectively sends packet loss retransmission request, from
And reducing the number for sending retransmission request so that transmitting terminal will not repeatedly retransmit some packet loss, save bandwidth usage amount, this
The transmission of sample, network data will be more unimpeded, quick.
The present invention provides a kind of method and terminal that packet loss retransmits, and the terminal can be sent out according to calculated apart from last time
The time of the retransmission request of same packet loss is sent to be compared with the Network Transmission Delays time, if sending same packet loss apart from last time
The time of retransmission request is more than the Network Transmission Delays time, then judges that this packet loss needs to send retransmission request.So that transmitting terminal is not
The packet loss can repeatedly be retransmitted due to repeatedly receiving the retransmission request of some packet loss, to reduce making for network bandwidth
With so that the transmission of network data is quicker.
The above content is combining, specific embodiment is made for the present invention to be further described, and it cannot be said that this hair
Bright specific implementation is confined to these explanations.For those of ordinary skill in the art to which the present invention belongs, it is not taking off
Under the premise of from present inventive concept, a number of simple deductions or replacements can also be made, all shall be regarded as belonging to the protection of the present invention
Range.