WO2016086345A1 - 心跳包定时器的识别方法和设备 - Google Patents

心跳包定时器的识别方法和设备 Download PDF

Info

Publication number
WO2016086345A1
WO2016086345A1 PCT/CN2014/092714 CN2014092714W WO2016086345A1 WO 2016086345 A1 WO2016086345 A1 WO 2016086345A1 CN 2014092714 W CN2014092714 W CN 2014092714W WO 2016086345 A1 WO2016086345 A1 WO 2016086345A1
Authority
WO
WIPO (PCT)
Prior art keywords
data packet
timer
termination time
timing termination
time
Prior art date
Application number
PCT/CN2014/092714
Other languages
English (en)
French (fr)
Inventor
彭钰
陈幼珍
杨淞
郭玉华
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2014/092714 priority Critical patent/WO2016086345A1/zh
Priority to US15/532,422 priority patent/US10673726B2/en
Priority to CN201480070440.2A priority patent/CN105850077B/zh
Publication of WO2016086345A1 publication Critical patent/WO2016086345A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/10Active monitoring, e.g. heartbeat, ping or trace-route
    • H04L43/103Active monitoring, e.g. heartbeat, ping or trace-route with adaptive polling, i.e. dynamically adapting the polling rate
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/10Active monitoring, e.g. heartbeat, ping or trace-route
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/14Monitoring arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0811Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking connectivity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M7/00Arrangements for interconnection between switching centres
    • H04M7/006Networks other than PSTN/ISDN providing telephone service, e.g. Voice over Internet Protocol (VoIP), including next generation networks with a packet-switched transport layer
    • H04M7/0081Network operation, administration, maintenance, or provisioning
    • H04M7/0084Network monitoring; Error detection; Error recovery; Network testing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0658Clock or time synchronisation among packet nodes
    • H04J3/0661Clock or time synchronisation among packet nodes using timestamps

Definitions

  • the embodiments of the present invention relate to the field of communications technologies, and in particular, to a method and a device for identifying a heartbeat packet timer.
  • the device carrying the client sets some periodic timers.
  • the device sends a heartbeat packet to the server. Initiating a heartbeat packet interaction with the server to confirm that the long connection link between the client and the server is normal; the timers for timing the heartbeat packets are sent to the heartbeat packet timer; in the heartbeat packet timer
  • the timing termination time arrives, even if the device is in the sleep state, it will be woken up; as the client with different functions (which can also be the application or process running by the device) is more and more, the heartbeat packet timing of the device is set.
  • the number of devices is also increasing, which causes the device to wake up frequently, which seriously affects the standby power consumption of the device.
  • the device In order to reduce the standby power consumption of the device, you can disable the heartbeat packet timer in some scenarios, or increase the duration of the heartbeat packet timer. Because the device sets more timers, you need to accurately identify the heartbeat packet timer. In the prior art, the number of times that the timer end time of the timer arrives is usually counted within a certain period of time. When the number exceeds the preset value, the timer is determined to be a heartbeat packet timer; it is conceivable that some devices are set. The timer may only be used to implement specific functions of the device and repeat timing. These timers are not heartbeat packet timers. Therefore, when the prior art identifies whether the timer is a heartbeat packet timer, it is easy to cause an identification error, and the device will be The performance of the work has an impact.
  • the embodiment of the invention provides a method and a device for identifying a heartbeat packet timer, which are used to improve the accuracy of the device to recognize the heartbeat packet timer.
  • an embodiment of the present invention provides a method for identifying a heartbeat packet timer, where the identification method is performed by a device that has a timer, and includes:
  • each associated data packet corresponding to each timing termination time of the timer; the associated data packet is associated with the timer; and the data packet transmitted by the device a data packet sent by the device, or a data packet received by the device, or a data packet sent by the device and a received data packet;
  • the associated data packet corresponding to each of the timing termination times of the timers is determined, including:
  • the associated data packet corresponding to the current timing termination time is a candidate associated data packet with the smallest difference between the processing time and the current timing termination time in each candidate associated data packet corresponding to the current timing termination time.
  • the processing time of the candidate associated data packet is a receiving moment of the device receiving the candidate associated data packet; if the candidate associated data packet is a data packet sent by the device, the candidate The processing time of the associated data packet is the transmission time of the candidate associated data packet sent by the device.
  • determining whether the timer is a heartbeat packet set by the device for transmitting a heartbeat packet according to each associated data packet and each timing termination time of the timer Timers including:
  • determining whether the timer is a heartbeat packet timer set by the device for transmitting a heartbeat packet according to the pheromone remaining amount includes:
  • the timer is the heartbeat packet timer
  • the next timing termination time is taken as a new current timing termination time. Returning to execute at least one data packet and a socket of the at least one data packet that are transmitted by the learned device in a period corresponding to a current timing termination time of the timer.
  • an embodiment of the present invention provides a device, where the device is configured with a timer, and the device includes:
  • a determining module configured to determine, in a data packet transmitted by the device, each associated data packet corresponding to each timing termination time of the timer; and the association between the associated data packet and the timer;
  • the data packet transmitted by the device is a data packet sent by the device, or a data packet received by the device, or a data packet sent by the device and a received data packet;
  • the determining module is configured to determine, according to each associated data packet and each timing termination time of the timer, whether the timer is a heartbeat packet timer set by the device as a transmission heartbeat packet.
  • a receiving module and a transmitting module In conjunction with the first aspect, in a first embodiment, a receiving module and a transmitting module;
  • the determining module is specifically configured to learn, at least one data packet and a socket of the at least one data packet that are transmitted by the device in a period corresponding to a current timing termination time of the timer;
  • the determining module is configured to determine, according to the socket of the at least one data packet, at least one candidate associated data packet corresponding to the current timing termination time in the at least one data packet;
  • the determining module is configured to determine, according to the current timing termination time and the processing time of the at least one candidate associated data packet corresponding to the current timing termination time, the associated data packet corresponding to the current timing termination time;
  • the associated data packet corresponding to the current timing termination time is a candidate associated data packet with the smallest difference between the processing time and the current timing termination time in each candidate associated data packet corresponding to the current timing termination time.
  • the processing time of the candidate associated data packet is a receiving moment at which the receiving module receives the candidate associated data packet; if the candidate associated data packet is sent by the sending module The data packet, the processing time of the candidate associated data packet is a sending moment at which the sending module sends the candidate associated data packet.
  • the determining module is specifically configured to acquire the current timing termination according to the current timing termination time and the processing time of the associated data packet corresponding to the current timing termination time.
  • the determining module is specifically configured to determine that the timer is the heartbeat packet timer if the pheromone remaining amount is greater than the first preset value
  • the determining module is specifically configured to: if the pheromone remaining amount is less than a second preset value, determine that the timer is not the heartbeat packet timer;
  • the determining module is specifically configured to: if the pheromone remaining amount is smaller than the first preset value and greater than the second preset value, when the next timing termination time comes, the next timing termination time is taken as And a new current timing termination time, returning to execute at least one data packet and a socket of the at least one data packet that are transmitted by the learned device in a period corresponding to a current timing termination time of the timer.
  • an embodiment of the present invention provides a device, where the device is configured with a timer, where the device includes:
  • a processor configured to determine, in a data packet transmitted by the device, each associated data packet corresponding to each timing termination time of the timer; and the association between the associated data packet and the timer;
  • the data packet transmitted by the device is a data packet sent by the device, or a data packet received by the device, or a data packet sent by the device and a received data packet;
  • the processor is configured to determine, according to each associated data packet and each timing termination time of the timer, whether the timer is a heartbeat packet timer set by the device as a transmission heartbeat packet.
  • the device further includes a transmitter and a receiver
  • the processor is specifically configured to learn, at least one data packet and a socket of the at least one data packet that are transmitted by the device in a period corresponding to a current timing termination time of the timer;
  • the processor is specifically configured to determine, according to the socket of the at least one data packet, at least one candidate associated data packet corresponding to the current timing termination time in the at least one data packet;
  • the processor is specifically configured to determine, according to the current timing termination time and the processing time of the at least one candidate associated data packet corresponding to the current timing termination time, the associated data packet corresponding to the current timing termination time;
  • the associated data packet corresponding to the current timing termination time is a candidate associated data packet with the smallest difference between the processing time and the current timing termination time in each candidate associated data packet corresponding to the current timing termination time.
  • the processing time of the candidate associated data packet is a receiving moment at which the receiver receives the candidate associated data packet; if the candidate association number is According to the data packet sent by the transmitter, the processing time of the candidate associated data packet is the transmission time of the transmitter to send the candidate associated data packet.
  • the processor is specifically configured to acquire the current timing termination according to a current timing termination time and a processing time of the associated data packet corresponding to the current timing termination time.
  • the processor is specifically configured to determine a pheromone margin according to each pheromone increment corresponding to the pheromone increment corresponding to the current timing termination time and each timing termination time before the current timing termination time;
  • the processor is specifically configured to determine, according to the pheromone remaining amount, whether the timer is a heartbeat packet timer set by the device as a transmission heartbeat packet.
  • the processor is specifically configured to determine that the timer is the heartbeat packet timer if the pheromone remaining amount is greater than the first preset value
  • the processor is specifically configured to: if the pheromone remaining amount is less than a second preset value, determine that the timer is not the heartbeat packet timer;
  • the processor is specifically configured to: if the pheromone remaining amount is less than the first preset value and greater than the second preset value, when the next timing termination time comes, the next timing termination time is taken as And a new current timing termination time, returning to execute at least one data packet and a socket of the at least one data packet that are transmitted by the learned device in a period corresponding to a current timing termination time of the timer.
  • the method and device for identifying a heartbeat packet timer provided by the embodiment of the present invention, considering a heartbeat packet
  • the device sends a heartbeat packet device to send and/or receive data packets. Therefore, all the data packets sent and/or received by the device and each associated data packet corresponding to each timer termination time of the timer may be used.
  • a high-accuracy rate is used to determine whether the timer is a heartbeat packet timer.
  • the device can automatically shut down the heartbeat packet timer or extend the duration of the heartbeat packet timer to reduce the power consumption of the device. It is more likely to avoid situations that affect other performance of the device due to misjudgment of the timer.
  • Embodiment 1 is a schematic flowchart of Embodiment 1 of a method for identifying a heartbeat packet timer according to the present invention
  • Embodiment 2 is a schematic flowchart of Embodiment 2 of a method for identifying a heartbeat packet timer according to the present invention
  • Embodiment 3 is a schematic flowchart of Embodiment 3 of a method for identifying a heartbeat packet timer according to the present invention
  • Embodiment 1 of an apparatus according to the present invention.
  • Figure 5 is a schematic structural diagram of Embodiment 2 of the device of the present invention.
  • Figure 6 is a schematic structural view of a third embodiment of the device according to the present invention.
  • FIG. 7 is a schematic structural diagram of Embodiment 4 of the apparatus of the present invention.
  • FIG. 1 is a schematic flowchart diagram of Embodiment 1 of a method for identifying a heartbeat packet timer according to the present invention.
  • the identification method in this embodiment is performed by a device with a timer, which may be a mobile terminal, a tablet computer, and a wearable device.
  • the specific identification methods are as follows:
  • the data packet transmitted by the device is a data packet sent by the device, or a data packet received by the device, or a data packet sent by the device and a received data packet;
  • each data packet sent and received by the device is sent and received for a process or an application running in the device.
  • an application running on a mobile terminal such as a common WeChat or QQ is through the software in the device.
  • the hardware sends and receives the service data packet and the heartbeat packet, and the device only performs the sending or receiving operation, and cannot directly know whether the sent or received data packet is a heartbeat packet, but since the timing of the heartbeat packet timer is terminated, the device
  • the heartbeat packet is transmitted with the peer device (including the heartbeat packet sent to the peer device and receives the heartbeat packet fed back from the peer device), and the device and the peer device are started at the timer termination time of the timer multiple times in succession.
  • the respective timing and termination timing device to send or receive data packets combined to determine whether the timer is a timer heartbeat packet;
  • the device can determine the data packet that may be the heartbeat packet in the sent data packet; or In the vicinity of the timing termination time of the heartbeat packet timer, the device receives the heartbeat packet fed back by the peer device for the running process or application. Optionally, the device may determine the data packet that may be the heartbeat packet in the received data packet.
  • these applications or processes in order to avoid the delay of sending heartbeat packets, these applications or processes usually notify the device to send data packets at a later time before the timing termination time of the heartbeat timer, so objectively When the time reaches the timing termination time of the heartbeat timer, the device receives the heartbeat packet fed back from the peer device. Therefore, in order to avoid the packet that may be the heartbeat packet, the device can also monitor the sending and receiving.
  • All the data packets, and the associated data packets that may be the heartbeat packets are determined in all the data packets sent and received by the device; the associated data packets are associated with the timer; since there are many applications running on the device, The information of each data packet sent and/or received by the device, such as an IP (Internet Protocol) number and a port number in the data packet, is learned that the data packet is sent or received for an application, and The timer is also set for the application, and the data packet is determined to be related to the timer, and the data packet is determined to be associated with the timer; further, considering the heartbeat packet When transmitting or receiving near the timing termination time of the heartbeat timer, each associated data packet corresponding to each timing termination time of the timer is determined in all the data packets transmitted and/or received by the device.
  • IP Internet Protocol
  • S102 Determine, according to each associated data packet and each timing termination time of the timer, whether the timer is a heartbeat packet timer set by the device as a transmission heartbeat packet.
  • the device may have a higher accuracy rate. Determining that the timer is a heartbeat packet timer set by the device for transmitting a heartbeat packet;
  • the time difference between the receiving time or the sending time of the associated data packet and the timed ending time corresponding to the associated data packet is higher, so The time difference between the receiving time or the sending time of each associated data packet and each timing termination time is determined by a higher accuracy rate, that is, the heartbeat packet timer set by the device as the transmission heartbeat packet.
  • the device sends a heartbeat packet device to send and/or receive data packets, so that all the packets and timers sent and/or received by the device are combined with each timer.
  • Each associated data packet corresponding to the termination time can determine whether the timer is a heartbeat packet timer with a high accuracy rate, so that the device can accurately close the heartbeat packet timer or extend the timing of the heartbeat packet timer when the device does not need to be frequently woken up.
  • the duration is reduced, and the power consumption of the device is reduced, and the other performance of the device is affected by the misjudgment of the timer.
  • FIG. 2 is a schematic flowchart diagram of Embodiment 2 of a method for identifying a heartbeat packet timer according to the present invention. As shown in FIG. 2, this embodiment is further described on the basis of the embodiment shown in FIG. 1, and specifically includes:
  • S201 Obtain at least one data packet and a socket of the at least one data packet that are transmitted by the device in a period corresponding to a current timing termination time of the timer.
  • the device monitors at least one data packet sent or received by the device, and acquires a socket of at least one data packet, and a socket of the data packet is used to describe the data packet.
  • IP address and port
  • the current timing termination time is a relative concept that changes with an objective time transition. For example, when the objective time reaches the time T1 and the time T1 is a timing termination time of the timer, the T1 time is the current time for the objective time to reach the T1 time. At the end of the timing, as the objective time elapses, the time T2 is reached, and the time T2 is also a timing termination time of the timer. For the objective time of reaching the time T2, the T2 time is the new current timing termination time. .
  • At least one data packet sent or received is monitored, and a socket of at least one data packet is obtained, and according to the socket of the at least one data packet, at least one data packet is determined to be a device.
  • Which application or process is sent or received, so that at least one data packet associated with the timer can be determined, and further, because at least one data packet associated with the timer is within a time period corresponding to the current timing termination time Received, the at least one data packet associated with the timer is a candidate associated data packet corresponding to the current timing termination time.
  • S203 Determine, according to a processing time of the at least one candidate associated data packet corresponding to the current timing termination time and the current timing termination time, the associated data packet corresponding to the current timing termination time.
  • the processing time of the candidate associated data packet is a receiving moment at which the device receives the candidate associated data packet; if the candidate associated data packet is a candidate associated data packet a data packet sent by the device, where the processing time of the candidate associated data packet is a sending moment at which the device sends the candidate associated data packet;
  • the associated data packet corresponding to the current timing termination time is a candidate associated data packet with the smallest difference between the processing time and the timing termination time in each candidate associated data packet corresponding to the current timing termination time; it is understandable that The smaller the time difference between the processing time of the data packet and the timing termination time of the timer, the higher the probability that the data packet is the heartbeat packet sent by the device at the timing of the timer termination, so that the timing is determined in combination with the data packet. Whether the accuracy of the heartbeat packet timer is higher, so in this embodiment, among the candidate association data packets corresponding to the timing termination time, the candidate association packet with the smallest difference between the processing time and the timing termination time is determined. The associated data packet corresponding to the timing termination time.
  • add i is the pheromone increment corresponding to the ith timing termination time, and the pheromone increment corresponding to the ith timing termination time is greater, and the associated data packet corresponding to the ith timing termination time is a heartbeat packet.
  • the associated data packet is inversely proportional to the probability of the heartbeat packet.
  • 1-delta i /timeout is used to determine the pheromone increment corresponding to the i-th timing termination time.
  • delta i is greater than timeout, it can be determined.
  • the associated data packet corresponding to the i-th timing termination time is not a heartbeat packet.
  • -THRESHOLD/4 is used to determine the pheromone increment corresponding to the i-th timing termination time.
  • the above pheromone margin is based on Determining, extra is an estimated pheromone increment, and the value can be flexibly set according to actual needs; S206, if the pheromone margin is greater than the first preset value, determining that the heartbeat feature conforms to the characteristics of the heartbeat packet timer .
  • the timer may be a heartbeat packet timer, so this embodiment is The foregoing steps S201 to S208 need to be repeatedly performed; for example, the objective time arrives.
  • time T1 is a timing termination time of the timer
  • T1 time is the current timing termination time of the timer, and then S201 to S205 are executed, which can be understood, at T1.
  • Each timing termination time that arrives before the time is also the current current timing termination time for the corresponding objective time; when the foregoing S201 to S205 are executed from the time T1, it is determined that the pheromone margin is greater than the first preset value or the pheromone If the remaining amount is less than the second preset value, it is determined whether the timer is a heartbeat packet timer according to the current timing termination time and the corresponding associated data packet before the current timing termination time, and the accuracy of the judgment result is higher. If the pheromone remaining amount is smaller than the first preset value and greater than the second preset value, it indicates that each associated data packet corresponding to the current timing termination time and the current timing termination time cannot be higher.
  • the accuracy rate determines whether the timer is a heartbeat packet timer. It can also be said that the current time is collected to determine the higher accuracy. Whether the timer is the information required by the heartbeat packet timer (that is, the processing timing of the associated packet termination time and the associated packet termination time corresponding to each timing termination time) is not comprehensive and complete, and therefore needs to be continuously collected for higher accuracy.
  • the rate is judged whether the timer is the information required by the heartbeat packet timer, and as the objective time elapses, when the time T2 arrives, that is, when the next timing termination time comes, the next timing termination time is taken as a new one. When the current timing is terminated, the process returns to S201.
  • the present embodiment corresponds to each timer termination time of the timer.
  • the time period corresponding to the timing termination time may be a time point, and since one time point can be subdivided into multiple wireless points in the differential category, based on a time point Including an infinite number of points, or delaying the monitoring of a data packet that may be a heartbeat packet due to a delay caused by internal data processing of the device, and the time period corresponding to the timing termination time is a time period having a certain duration.
  • the device sends a heartbeat packet device to send and/or receive data packets, so that all the packets and timers sent and/or received by the device are combined with each timer.
  • Each associated data packet corresponding to the termination time can determine whether the timer is a heartbeat packet timer with a high accuracy rate, so that the device can accurately close the heartbeat packet timer or extend the timing of the heartbeat packet timer when the device does not need to be frequently woken up.
  • the duration is reduced, and the power consumption of the device is reduced, and the other performance of the device is affected by the misjudgment of the timer.
  • FIG. 3 is a schematic flowchart diagram of Embodiment 3 of a method for identifying a heartbeat packet timer according to the present invention. As shown in FIG. 3, this embodiment describes a specific application flow of the above identification method in combination with the foregoing embodiment shown in FIG. 1 or FIG. 2, which is specifically as follows:
  • S301 Determine whether the record timer of the timer is a heartbeat packet timer, or is not a heartbeat packet timer; if yes, stop; if not, execute S302.
  • the heartbeat packet timer arrives at a timing termination time, if the device is in the awake state, the device directly sends the heartbeat packet, but if the device is in the sleep state, when the timing termination time of the heartbeat packet timer comes, the device will Wake-up to send a heartbeat packet; when a timer termination time of the above timer comes, the reason that the device is in the awake state may be because a timer termination time of the timer comes, or the heartbeat set by the device for other applications or processes.
  • the packet timer wakes up the device, or the device is transmitting the service data packet, and is also in the awake state; but if the device is in the sleep state and the device is not awake when the timer expires, the device can determine The timer is not a heartbeat packet timer.
  • the timer After determining that the timer is not a heartbeat packet timer, executing S311, and recording, in the description information of the timer, that the timer is not a heartbeat packet timer, in the subsequent time, when the device needs to close the heartbeat packet timer
  • the timer is not recognized by performing the following steps, and the timer is not determined to be a heartbeat packet timer.
  • S305 Determine, according to a processing time of the at least one candidate associated data packet corresponding to the current timing termination time and the current timing termination time, the associated data packet corresponding to the current timing termination time.
  • the updated description information is that the timer is a heartbeat packet timer; if S311 is executed after S302 or S309 is executed, the updated description information is that the timer is not a heartbeat packet timer.
  • the device in consideration of the timing termination time of the heartbeat packet timer, sends a heartbeat packet device to send or receive a data packet, so that the data packet transmitted and/or received by the device corresponds to each timing termination time of the timer.
  • Each associated data packet can determine whether the timer is a heartbeat packet timer with a high accuracy rate, so that the device can accurately turn off the heartbeat packet timer or extend the timing of the heartbeat packet timer when the device does not need to be frequently woken up, and reduce the duration of the heartbeat packet timer.
  • the power consumption of the device and to a greater extent, avoids the situation that affects other performance of the device due to misjudgment of the timer.
  • the device may set at least one timer for multiple applications or processes; any of the timers set by the device may adopt the foregoing various method embodiments to determine whether the timer is a heartbeat packet timer.
  • FIG. 4 is a schematic structural diagram of Embodiment 1 of the device according to the present invention. As shown in FIG. 4, the device in this embodiment sets a timer, including:
  • a determining module 41 configured to determine, in a data packet transmitted by the device, each associated data packet corresponding to each timing termination time of the timer; and the association between the associated data packet and the timer;
  • the data packet transmitted by the device is a data packet sent by the device, or a data packet received by the device, or a data packet sent by the device and a received data packet;
  • the determining module 42 is configured to determine, according to each associated data packet and each timing termination time of the timer, whether the timer is a heartbeat packet timer set by the device as a transmission heartbeat packet.
  • the device in consideration of the timing termination time of the heartbeat packet timer, the device sends a heartbeat packet device to send or receive a data packet, so the data packet and timer sent and/or received in conjunction with the device are combined.
  • Each associated data packet corresponding to each timing termination time can determine whether the timer is a heartbeat packet timer with a high accuracy rate, so that the device can accurately close the heartbeat packet timer or extend the heartbeat packet timing when the device does not need to be frequently woken up.
  • the timing of the device reduces the power consumption of the device, and it is more likely to avoid other conditions that affect the performance of the device due to misjudgment of the timer.
  • FIG. 5 is a schematic structural diagram of Embodiment 2 of the device according to the present invention. As shown in FIG. 5, this embodiment is further described on the basis of the embodiment shown in FIG. 4. Specifically, the device includes a receiving module 43 and a sending module 44: the receiving module 43 is configured to receive a data packet. The sending module 44 is configured to send a data packet;
  • the determining module 41 is specifically configured to learn, at least one data packet and a socket of the at least one data packet that are transmitted by the device in a period corresponding to a current timing termination time of the timer;
  • the determining module 41 is specifically configured to determine, according to the socket of the at least one data packet, at least one candidate associated data packet corresponding to the current timing termination time in the at least one data packet;
  • the determining module 41 is specifically configured to determine, according to the current timing end time and the processing time of the at least one candidate associated data packet corresponding to the current timing termination time, the associated data packet corresponding to the current timing termination time;
  • the associated data packet corresponding to the current timing termination time is a candidate associated data packet with the smallest difference between the processing time and the current timing termination time in each candidate associated data packet corresponding to the current timing termination time.
  • the processing time of the candidate associated data packet is the receiving time of the receiving associated data packet by the receiving module 43; if the candidate associated data packet is the data sent by the device The packet, the processing time of the candidate associated data packet is the transmission time of the candidate associated data packet sent by the sending module 44.
  • the determining module 42 is specifically configured to acquire a pheromone increment corresponding to the current timing termination time according to a current timing termination time and a processing time of the associated data packet corresponding to the current timing termination time;
  • the determining module 42 is specifically configured to: if the pheromone remaining amount is greater than the first preset value, determine that the timer is a heartbeat packet timer;
  • the determining module 42 is specifically configured to: if the pheromone remaining amount is less than a second preset value, determine that the timer is not a heartbeat packet timer;
  • the determining module 42 is specifically configured to: when the pheromone remaining amount is smaller than the first preset value and greater than the second preset value, when the next timing termination time comes, the next timing termination time is As a new current timing termination time, returning to execute the at least one data packet and the socket of the at least one data packet that are transmitted by the learned device in a period corresponding to a current timing termination time of the timer.
  • the device in consideration of the timing termination time of the heartbeat packet timer, sends a heartbeat packet device to send or receive a data packet, so that the data packet transmitted and/or received by the device corresponds to each timing termination time of the timer.
  • Each associated data packet can determine whether the timer is a heartbeat packet timer with a high accuracy rate, so that the device can accurately turn off the heartbeat packet timer or extend the timing of the heartbeat packet timer when the device does not need to be frequently woken up, and reduce the duration of the heartbeat packet timer.
  • the power consumption of the device and to a greater extent, avoids the situation that affects other performance of the device due to misjudgment of the timer.
  • FIG. 6 is a schematic structural diagram of Embodiment 3 of the device according to the present invention. As shown in FIG. 6, the device in this embodiment is configured with a timer, and the device includes:
  • the processor 51 is configured to determine, in a data packet that is sent by the device, each associated data packet corresponding to each timing termination time of the timer; and the association between the associated data packet and the timer;
  • the data packet transmitted by the device is a data packet sent by the device, or a data packet received by the device, or a data packet sent by the device and a received data packet;
  • the processor 51 is configured to terminate according to each associated data packet and each timer of the timer At the moment, it is determined whether the timer is a heartbeat packet timer set by the device for transmitting a heartbeat packet.
  • the device in consideration of the timing termination time of the heartbeat packet timer, sends a heartbeat packet device to send or receive a data packet, so that the data packet transmitted and/or received by the device corresponds to each timing termination time of the timer.
  • Each associated data packet can determine whether the timer is a heartbeat packet timer with a high accuracy rate, so that the device can accurately turn off the heartbeat packet timer or extend the timing of the heartbeat packet timer when the device does not need to be frequently woken up, and reduce the duration of the heartbeat packet timer.
  • the power consumption of the device and to a greater extent, avoids the situation that affects other performance of the device due to misjudgment of the timer.
  • each module in the foregoing device embodiments is used to perform the corresponding steps in the foregoing method embodiments.
  • FIG. 7 is a schematic structural diagram of Embodiment 4 of the apparatus of the present invention. As shown in FIG. 7, the embodiment is further described based on the embodiment shown in FIG. 6.
  • the device further includes: a transmitter 52 and a receiver 53; and the transmitter 52.
  • the receiver For transmitting a data packet; the receiver is configured to receive a data packet;
  • the processor 51 is specifically configured to learn, at least one data packet and a socket of the at least one data packet that are transmitted by the device in a period corresponding to a current timing termination time of the timer;
  • the processor 51 is specifically configured to determine, according to the socket of the at least one data packet, at least one candidate associated data packet corresponding to the current timing termination time in the at least one data packet;
  • the processor 51 is specifically configured to determine, according to the current timing termination time and the processing time of the at least one candidate associated data packet corresponding to the current timing termination time, the associated data packet corresponding to the current timing termination time;
  • the associated data packet corresponding to the current timing termination time is a candidate associated data packet with the smallest difference between the processing time and the current timing termination time in each candidate associated data packet corresponding to the current timing termination time.
  • the processing time of the candidate associated data packet is a receiving moment at which the receiver 53 receives the candidate associated data packet; if the candidate associated data packet is a transmitter
  • the data packet transmitted by 52, the processing time of the candidate associated data packet is the transmission time at which the transmitter 52 transmits the candidate associated data packet.
  • the processor 51 is configured to acquire a pheromone corresponding to the current timing termination time according to a current timing termination time and a processing time of the associated data packet corresponding to the current timing termination time. Increment
  • the processor 51 is specifically configured to determine a pheromone margin according to each pheromone increment corresponding to the pheromone increment corresponding to the current timing termination time and each timing termination time before the current timing termination time;
  • the processor 51 is specifically configured to determine, according to the pheromone remaining amount, whether the timer is a heartbeat packet timer set by the device as a transmission heartbeat packet.
  • the processor 51 is specifically configured to: if the pheromone remaining amount is greater than the first preset value, determine that the timer is a heartbeat packet timer;
  • the processor 51 is specifically configured to: if the pheromone remaining amount is less than a second preset value, determine that the timer is not a heartbeat packet timer;
  • the processor 51 is specifically configured to: when the pheromone remaining amount is less than the first preset value and greater than the second preset value, when the next timing termination time comes, the next timing termination time is As a new current timing termination time, returning to execute the at least one data packet and the socket of the at least one data packet that are transmitted by the learned device in a period corresponding to a current timing termination time of the timer.
  • the device in consideration of the timing termination time of the heartbeat packet timer, sends a heartbeat packet device to send or receive a data packet, so that the data packet transmitted and/or received by the device corresponds to each timing termination time of the timer.
  • Each associated data packet can determine whether the timer is a heartbeat packet timer with a high accuracy rate, so that the device can accurately turn off the heartbeat packet timer or extend the timing of the heartbeat packet timer when the device does not need to be frequently woken up, and reduce the duration of the heartbeat packet timer.
  • the power consumption of the device and to a greater extent, avoids the situation that affects other performance of the device due to misjudgment of the timer.
  • each device in the foregoing device embodiment such as a processor, a transmitter, and a connection
  • the receiver is specifically configured to perform the corresponding steps in the foregoing various method embodiments.
  • specific implementation processes and beneficial effects reference may be made to the foregoing various method embodiments.
  • the foregoing program may be stored in a computer readable storage medium, and the program is executed when executed.
  • the foregoing steps include the steps of the foregoing method embodiments; and the foregoing storage medium includes: a medium that can store program codes, such as a ROM, a RAM, a magnetic disk, or an optical disk.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Cardiology (AREA)
  • General Health & Medical Sciences (AREA)
  • Environmental & Geological Engineering (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明实施例提供一种心跳包定时器的识别方法和设备,所述识别方法由设置了定时器的设备执行,包括:在所述设备传输的数据包中,确定所述定时器的各个计时终止时刻对应的各个关联数据包;所述关联数据包与所述定时器之间存在关联关系;所述设备传输的数据包为所述设备发送的数据包,或为所述设备接收的数据包,或为所述设备发送的数据包和接收的数据包;根据各个关联数据包和所述定时器的各个计时终止时刻,判断所述定时器是否为所述设备为传输心跳包设置的心跳包定时器;所述心跳包定时器的识别方法和设备通过结合设备传输的数据包和定时器的各个计时终止时刻对应的各个关联数据包,可以以较高的准确率判断定时器是否为心跳包定时器。

Description

心跳包定时器的识别方法和设备 技术领域
本发明实施例涉及通信技术领域,尤其涉及一种心跳包定时器的识别方法和设备。
背景技术
为了保持客户端与服务器之间长连接链路正常,承载该客户端的设备会设置一些周期性计时的定时器,每当定时器设定的计时终止时刻到达时,设备便会向服务器发送心跳包,发起与服务器之间的心跳包交互,以确认客户端与服务器之间长连接链路正常;这些用于为设备发送心跳包而计时的定时器为心跳包定时器;在心跳包定时器的计时终止时刻到达时,即使设备处于休眠状态,也会被唤醒;随着设备承载的具有不同功能的客户端(也可以为设备运行的应用或进程)越来越多,设备设置的心跳包定时器也不断增多,则导致设备唤醒频繁,严重影响设备的待机功耗。
为了降低设备的待机功耗,可以在一些场景下关闭心跳包定时器,或者增加心跳包定时器的计时周期的时长;由于设备设置的定时器较多,需要准确识别出心跳包定时器;而在现有技术中,通常是在一定时间内统计定时器的计时终止时刻到达的次数,当该次数超过预设值,便确定该定时器为心跳包定时器;可以想到的,设备设置的一些定时器可能仅用于实现设备的特定功能而重复计时,这些定时器并不是心跳包定时器,因此采用现有技术识别定时器是否为心跳包定时器时,容易出现识别错误,则会对设备的工作性能造成影响。
发明内容
本发明实施例提供一种心跳包定时器的识别方法和设备,用于提高设备识别心跳包定时器的准确率。
第一方面,本发明实施例提供一种心跳包定时器的识别方法,所述识别方法由设置了定时器的设备执行,包括:
在所述设备传输的数据包中,确定所述定时器的各个计时终止时刻对应的各个关联数据包;所述关联数据包与所述定时器之间存在关联关系;所述设备传输的数据包为所述设备发送的数据包,或为所述设备接收的数据包,或为所述设备发送的数据包和接收的数据包;
根据各个关联数据包和所述定时器的各个计时终止时刻,判断所述定时器是否为所述设备为传输心跳包设置的心跳包定时器。
结合第一方面,在第一实施方式中,确定所述定时器的各个计时终止时刻中每一个计时终止时刻对应的关联数据包,包括:
获知设备在定时器的当前计时终止时刻对应的时段内,传输的至少一个数据包和所述至少一个数据包的套接字;
根据所述至少一个数据包的套接字,在所述至少一个数据包中确定所述当前计时终止时刻对应的至少一个候选关联数据包;
根据所述当前计时终止时刻和所述当前计时终止时刻对应的至少一个候选关联数据包的处理时刻,确定所述当前计时终止时刻对应的关联数据包;
其中,所述当前计时终止时刻对应的关联数据包为在所述当前计时终止时刻对应的各个候选关联数据包中,处理时刻与所述当前计时终止时刻之间的差值最小的候选关联数据包;
若所述候选关联数据包为设备接收的数据包,该候选关联数据包的处理时刻为设备接收该候选关联数据包的接收时刻;若所述候选关联数据包为设备发送的数据包,该候选关联数据包的处理时刻为设备发送该候选关联数据包的发送时刻。
结合第一方面第一实施方式,在第二实施方式中,根据各个关联数据包和所述定时器的各个计时终止时刻,判断所述定时器是否为所述设备为传输心跳包设置的心跳包定时器,包括:
根据当前计时终止时刻和所述当前计时终止时刻对应的关联数据包的处理时刻,获取所述当前计时终止时刻对应的信息素增量;
根据所述当前计时终止时刻对应的信息素增量和所述当前计时终止时刻之前的各个计时终止时刻对应的各个信息素增量,确定信息素余量;
根据所述信息素余量,判断所述定时器是否为所述设备为传输心跳包设置的心跳包定时器。
结合第一方面第二实施方式,在第三实施方式中,根据所述信息素余量,判断所述定时器是否为所述设备为传输心跳包设置的心跳包定时器,包括:
若信息素余量大于第一预设值,则确定所述定时器为所述心跳包定时器;
若所述信息素余量小于第二预设值,则确定所述定时器不为所述心跳包定时器;
若所述信息素余量小于所述第一预设值且大于所述第二预设值,则在下一个计时终止时刻到来时,将所述下一个计时终止时刻作为新的当前计时终止时刻,返回执行所述获知设备在定时器的当前计时终止时刻对应的时段内,传输的至少一个数据包和所述至少一个数据包的套接字。
结合第一方面第三实施方式,在第四实施方式中,所述定时器的各个计时终止时刻中任意一个计时终止时刻对应的信息素增量是根据
Figure PCTCN2014092714-appb-000001
确定的;所述信息素余量surplus是根据
Figure PCTCN2014092714-appb-000002
确定的,其中,i和N均为正整数,i的取值为所述当前计时终止时刻之前的各个计时终止时刻的序号,N的取值为所述当前计时终止时刻的序号;addi为第i个计时终止时刻对应的信息素增量,deltai为第i个计时终止时刻与第i个计时终止时刻对应的关联数据包的处理时刻之间的偏移量,deltai=|whenElapsedi-netElapsedi|;whenElapsedi为第i个计时终止时刻,netElapsedi为第i个计时终止时刻对应的关联数据包的处理时刻,timeout用于表示容忍的最大偏移量,extra为预估信息素增量;THRESHOLD为第一预设值;-THRESHOLD为所述第二预设值。
第二方面,本发明实施例提供一种设备,该设备设置了定时器,所述设备包括:
确定模块,用于在所述设备传输的数据包中,确定所述定时器的各个计时终止时刻对应的各个关联数据包;所述关联数据包与所述定时器之间存在关联关系;所述设备传输的数据包为所述设备发送的数据包,或为所述设备接收的数据包,或为所述设备发送的数据包和接收的数据包;
判断模块,用于根据各个关联数据包和所述定时器的各个计时终止时刻,判断所述定时器是否为所述设备为传输心跳包设置的心跳包定时器。
结合第一方面,在第一实施方式中,接收模块和发送模块;
所述确定模块具体用于获知设备在定时器的当前计时终止时刻对应的时段内,传输的至少一个数据包和所述至少一个数据包的套接字;
所述确定模块具体用于根据所述至少一个数据包的套接字,在所述至少一个数据包中确定所述当前计时终止时刻对应的至少一个候选关联数据包;
所述确定模块具体用于根据所述当前计时终止时刻和所述当前计时终止时刻对应的至少一个候选关联数据包的处理时刻,确定所述当前计时终止时刻对应的关联数据包;
其中,所述当前计时终止时刻对应的关联数据包为在所述当前计时终止时刻对应的各个候选关联数据包中,处理时刻与所述当前计时终止时刻之间的差值最小的候选关联数据包;
若所述候选关联数据包为接收模块接收的数据包,该候选关联数据包的处理时刻为所述接收模块接收该候选关联数据包的接收时刻;若所述候选关联数据包为发送模块发送的数据包,该候选关联数据包的处理时刻为所述发送模块发送该候选关联数据包的发送时刻。
结合第二方面第一实施方式,在第二实施方式中,所述判断模块具体用于根据当前计时终止时刻和所述当前计时终止时刻对应的关联数据包的处理时刻,获取所述当前计时终止时刻对应的信息素增量;
根据所述当前计时终止时刻对应的信息素增量和所述当前计时终止时刻之前的各个计时终止时刻对应的各个信息素增量,确定信息素余量;
根据所述信息素余量,判断所述定时器是否为所述设备为传输心跳包设置的心跳包定时器。
结合第二方面第二实施方式,在第三实施方式中,所述判断模块具体用于若信息素余量大于第一预设值,则确定所述定时器为所述心跳包定时器;
所述判断模块具体用于若所述信息素余量小于第二预设值,则确定所述定时器不为所述心跳包定时器;
所述判断模块具体用于若所述信息素余量小于所述第一预设值且大于所述第二预设值,则在下一个计时终止时刻到来时,将所述下一个计时终止时刻作为新的当前计时终止时刻,返回执行所述获知设备在定时器的当前计时终止时刻对应的时段内,传输的至少一个数据包和所述至少一个数据包的套接字。
结合第二方面第三实施方式,在第四实施方式中,所述定时器的各个计时终止时刻中任意一个计时终止时刻对应的信息素增量是根据
Figure PCTCN2014092714-appb-000003
确定的;所述信息素余量surplus是根据
Figure PCTCN2014092714-appb-000004
确定的,其中,i和N均为正整数,i的取值为所述当前计时终止时刻之前的各个计时终止时刻的序号,N的取值为所述当前计时终止时刻的序号;addi为第i个计时终止时刻对应的信息素增量,deltai为第i个计时终止时刻与第i个计时终止时刻对应的关联数据包的处理时刻之间的偏移量,deltai=|whenElapsedi-netElapsedi|;whenElapsedi为第i个计时终止时刻,netElapsedi为第i个计时终止时刻对应的关联数据包的处理时刻,timeout用于表示容忍的最大偏移量,extra为预估信息素增量;THRESHOLD为第一预设值;-THRESHOLD为所述第二预设值。
第三方面,本发明实施例提供一种设备,该设备设置了定时器,所述设备包括:
处理器,用于在所述设备传输的数据包中,确定所述定时器的各个计时终止时刻对应的各个关联数据包;所述关联数据包与所述定时器之间存在关联关系;所述设备传输的数据包为所述设备发送的数据包,或为所述设备接收的数据包,或为所述设备发送的数据包和接收的数据包;
所述处理器用于根据各个关联数据包和所述定时器的各个计时终止时刻,判断所述定时器是否为所述设备为传输心跳包设置的心跳包定时器。
结合第三方面,在第一实施方式中,所述设备还包括发送器和接收器;
所述处理器具体用于获知设备在定时器的当前计时终止时刻对应的时段内,传输的至少一个数据包和所述至少一个数据包的套接字;
所述处理器具体用于根据所述至少一个数据包的套接字,在所述至少一个数据包中确定所述当前计时终止时刻对应的至少一个候选关联数据包;
所述处理器具体用于根据所述当前计时终止时刻和所述当前计时终止时刻对应的至少一个候选关联数据包的处理时刻,确定所述当前计时终止时刻对应的关联数据包;
其中,所述当前计时终止时刻对应的关联数据包为在所述当前计时终止时刻对应的各个候选关联数据包中,处理时刻与所述当前计时终止时刻之间的差值最小的候选关联数据包;
若所述候选关联数据包为接收器接收的数据包,该候选关联数据包的处理时刻为所述接收器接收该候选关联数据包的接收时刻;若所述候选关联数 据包为发送器发送的数据包,该候选关联数据包的处理时刻为所述发送器发送该候选关联数据包的发送时刻。
结合第三方面第一实施方式,在第二实施方式中,所述处理器具体用于根据当前计时终止时刻和所述当前计时终止时刻对应的关联数据包的处理时刻,获取所述当前计时终止时刻对应的信息素增量;
所述处理器具体用于根据所述当前计时终止时刻对应的信息素增量和所述当前计时终止时刻之前的各个计时终止时刻对应的各个信息素增量,确定信息素余量;
所述处理器具体用于根据所述信息素余量,判断所述定时器是否为所述设备为传输心跳包设置的心跳包定时器。
结合第三方面第二实施方式,在第三实施方式中,所述处理器具体用于若信息素余量大于第一预设值,则确定所述定时器为所述心跳包定时器;
所述处理器具体用于若所述信息素余量小于第二预设值,则确定所述定时器不为所述心跳包定时器;
所述处理器具体用于若所述信息素余量小于所述第一预设值且大于所述第二预设值,则在下一个计时终止时刻到来时,将所述下一个计时终止时刻作为新的当前计时终止时刻,返回执行所述获知设备在定时器的当前计时终止时刻对应的时段内,传输的至少一个数据包和所述至少一个数据包的套接字。
结合第三方面第三实施方式,在第四实施方式中,所述定时器的各个计时终止时刻中任意一个计时终止时刻对应的信息素增量是根据
Figure PCTCN2014092714-appb-000005
确定的;所述信息素余量surplus是根据
Figure PCTCN2014092714-appb-000006
确定的,其中,i和N均为正整数,i的取值为所述当前计时终止时刻之前的各个计时终止时刻的序号,N的取值为所述当前计时终止时刻的序号;addi为第i个计时终止时刻对应的信息素增量,deltai为第i个计时终止时刻与第i个计时终止时刻对应的关联数据包的处理时刻之间的偏移量,deltai=|whenElapsedi-netElapsedi|;whenElapsedi为第i个计时终止时刻,netElapsedi为第i个计时终止时刻对应的关联数据包的处理时刻,timeout用于表示容忍的最大偏移量,extra为预估信息素增量;THRESHOLD为第一预设值;-THRESHOLD为所述第二预设值。
本发明实施例提供的心跳包定时器的识别方法和设备,考虑到在心跳包 定时器的计时终止时刻,设备便会发送心跳包设备发送和/或接收数据包,因此结合设备发送和/或接收的全部数据包和定时器的各个计时终止时刻对应的各个关联数据包,可以以较高的准确率判断定时器是否为心跳包定时器,便于设备在不需要被频繁唤醒时,准确关闭心跳包定时器或延长心跳包定时器的计时时长,降低设备的功耗,且以较大可能的避免了因对定时器误判而影响了设备的其他性能的情况。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本发明心跳包定时器的识别方法实施例一的流程示意图;
图2为本发明心跳包定时器的识别方法实施例二的流程示意图;
图3为本发明心跳包定时器的识别方法实施例三的流程示意图;
图4为本发明设备实施例一的结构示意图;
图5为本发明设备实施例二的结构示意图;
图6为本发明设备实施例三的结构示意图;
图7为本发明设备实施例四的结构示意图。
具体实施方式
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
图1为本发明心跳包定时器的识别方法实施例一的流程示意图。如图1所示,本实施例中的识别方法由设置了定时器的设备执行,该设备可以为移动终端、平板电脑及可穿戴设备,具体的识别方法如下:
S101、在设备传输的数据包中,确定与定时器的各个计时终止时刻对应的各个关联数据包。
所述设备传输的数据包为所述设备发送的数据包,或为所述设备接收的数据包,或为所述设备发送的数据包和接收的数据包;
考虑到在心跳包定时器的计时终止时刻,设备便会发送心跳包,本实施例为了准确识别定时器是否为心跳包定时器,需要获知该定时器在每一次的计时终止时刻是否发送了心跳包;可以理解的,设备发送、接收的各个数据包均是为设备内运行的进程或应用进行发送及接收的,例如常见的微信、QQ等移动终端上运行的应用,是通过设备内的软件和/或硬件发送、接收业务数据包、心跳包,设备仅执行发送或接收操作,不能直接获知发送或接收的数据包是否为心跳包,但由于在心跳包定时器的计时终止时刻起,设备会开始与对端设备进行心跳包的传输(包括向对端设备发送心跳包并接收对端设备反馈的心跳包),则连续多次都在定时器的计时终止时刻起设备与对端设备进行了可能为心跳包的数据包的传输,该定时器才有可能为心跳包定时器,因此本实施例中将各个计时终止时刻和设备发送或接收的数据包结合起来,以确定该定时器是否为心跳包定时器;
考虑到在心跳包定时器的计时终止时刻,设备便会为运行的进程或应用发送心跳包,可选的,设备可以在发送的数据包中确定可能为心跳包的数据包;或者考虑到在心跳包定时器的计时终止时刻的附近,设备便会为运行的进程或应用接收对端设备反馈的心跳包,可选的,设备可以在接收的数据包中确定可能为心跳包的数据包;
但考虑到上述应用或进程的运行机制不同,这些应用或进程为了避免心跳包的发送时延,通常会在心跳定时器的计时终止时刻之前的稍早时刻便通知设备发送数据包,因此在客观时间真正到达心跳定时器的计时终止时刻时,设备会收到对端设备反馈的心跳包,因此为了避免因未监听到可能为心跳包的数据包,较优的,设备还可以监听发送和接收的全部数据包,并在设备发送和接收的全部数据包中确定可能为心跳包的关联数据包;该关联数据包与定时器之间存在关联关系;由于设备上运行的应用较多,可以根据所述设备发送和/或接收的各个数据包的信息,例如数据包中的IP(Internet Protocol,网络互连协议)号和端口号,获知该数据包是为某个应用发送或接收的,且 上述定时器也是为该应用设置的,则可确定该数据包是与该定时器是针对同一个应用来说的,则确定该数据包为与定时器存在关联关系;进一步的,考虑到心跳包是在心跳定时器的计时终止时刻附近发送或接收,则在所述设备发送和/或接收的全部数据包中,确定与所述定时器的各个计时终止时刻对应的各个关联数据包。
S102、根据各个关联数据包和所述定时器的各个计时终止时刻,判断所述定时器是否为所述设备为传输心跳包设置的心跳包定时器。
具体的,当设备确定在每一个定时器的计时终止时刻,设备均发送了与各个计时终止时刻对应的各个关联数据包,且各个关联数据包的格式、大小相似,则可以较高的准确率确定该定时器即为所述设备为传输心跳包设置的心跳包定时器;
或者可选的,考虑到关联数据包的接收时刻或发送时刻与该关联数据包对应的计时终止时刻之间的时间差越小,该关联数据包为心跳包的可能性越高,因此还可以根据各个关联数据包的接收时刻或发送时刻与各个计时终止时刻之间的时间差,以较高的准确率确定该定时器即为所述设备为传输心跳包设置的心跳包定时器。
本实施例中,考虑到在心跳包定时器的计时终止时刻,设备便会发送心跳包设备发送和/或接收数据包,因此结合设备发送和/或接收的全部数据包和定时器的各个计时终止时刻对应的各个关联数据包,可以以较高的准确率判断定时器是否为心跳包定时器,便于设备在不需要被频繁唤醒时,准确关闭心跳包定时器或延长心跳包定时器的计时时长,降低设备的功耗,且以较大可能的避免了因对定时器误判而影响了设备的其他性能的情况。
图2为本发明心跳包定时器的识别方法实施例二的流程示意图。如图2所示,本实施例是在图1所示的实施例的基础上,做出进一步的描述,具体包括:
S201、获知设备在定时器的当前计时终止时刻对应的时段内,传输的至少一个数据包和所述至少一个数据包的套接字。
在当前计时终止时刻对应的时段内,设备会监听设备发送或接收的至少一个数据包,并获取至少一个数据包的套接字,上述数据包的套接字(socket)用于描述该数据包的IP地址和端口;
上述当前计时终止时刻为随客观时间推移而变化的相对概念,例如客观时间到达T1时刻,且T1时刻为定时器的一个计时终止时刻,则对于到达T1时刻的客观时间来说,T1时刻为当前计时终止时刻,随着客观时间的推移,到达T2时刻,该T2时刻也为定时器的一个计时终止时刻,则对于到达T2时刻的客观时间来说,该T2时刻即为新的当前计时终止时刻。
S202、根据至少一个数据包的套接字,在至少一个数据包中确定所述当前计时终止时刻对应的至少一个候选关联数据包。
在当前计时终止时刻对应的时段内,监听到发送或接收的至少一个数据包,并获取至少一个数据包的套接字,根据至少一个数据包的套接字可以确定至少一个数据包分别是设备为哪个应用或进程发送或接收的,从而可确定至少一个与定时器存在关联关系的数据包,进一步的,由于至少一个与定时器存在关联关系的数据包是在当前计时终止时刻对应的时段内接收的,所述至少一个与定时器存在关联关系的数据包均为当前计时终止时刻对应的候选关联数据包。
S203、根据当前计时终止时刻和当前计时终止时刻对应的至少一个候选关联数据包的处理时刻,确定所述当前计时终止时刻对应的关联数据包。
在上述S202中确定的各个候选关联数据包中,若候选关联数据包为设备接收的数据包,该候选关联数据包的处理时刻为设备接收该候选关联数据包的接收时刻;若候选关联数据包为设备发送的数据包,该候选关联数据包的处理时刻为设备发送该候选关联数据包的发送时刻;
而上述当前计时终止时刻对应的关联数据包为在该当前计时终止时刻对应的各个候选关联数据包中,处理时刻与该计时终止时刻之间的差值最小的候选关联数据包;可以理解的,数据包的处理时刻与定时器的计时终止时刻之间的时间差越小,该数据包是设备在该定时器的计时终止时刻发送的心跳包的可能性越高,从而结合该数据包判断该定时器是否为心跳包定时器的准确率越高,因此本实施例是在计时终止时刻对应的各个候选关联数据包中,确定处理时刻与该计时终止时刻之间的差值最小的候选关联数据包为该计时终止时刻对应的关联数据包。
S204、根据当前计时终止时刻和当前计时终止时刻对应的关联数据包的处理时刻,获取所述当前计时终止时刻对应的信息素增量。
本实施例中,定时器的各个计时终止时刻中任意一个计时终止时刻对应 的信息素增量是根据
Figure PCTCN2014092714-appb-000007
确定的,i和N均为正整数,i的取值为所述当前计时终止时刻之前的各个计时终止时刻的序号,N的取值为所述当前计时终止时刻的序号;addi为第i个计时终止时刻对应的信息素增量,deltai为第i个计时终止时刻与第i个计时终止时刻对应的关联数据包的处理时刻之间的偏移量,deltai=|whenElapsedi-netElapsedi|;whenElapsedi为第i个计时终止时刻,netElapsedi为第i个计时终止时刻对应的关联数据包的处理时刻,timeout用于表示容忍的最大偏移量(取值可以根据实际需要灵活设置);THRESHOLD为第一预设值;-THRESHOLD为所述第二预设值;
具体的,addi为第i个计时终止时刻对应的信息素增量,第i个计时终止时刻对应的信息素增量越大,则第i个计时终止时刻对应的关联数据包为心跳包的可能性越大;在确定addi时,考虑到deltai越大,说明第i个计时终止时刻对应的关联数据包越不可能为心跳包,即deltai的大小与第i个计时终止时刻对应的关联数据包为心跳包的概率成反比,因此在deltai小于timeout时,采用1-deltai/timeout确定第i个计时终止时刻对应的信息素增量,在deltai大于timeout时,可以确定第i个计时终止时刻对应的关联数据包不为心跳包,为了在S205中挥发信息素,则采用-THRESHOLD/4确定第i个计时终止时刻对应的信息素增量。
S205、根据所述当前计时终止时刻对应的变量值和所述当前计时终止时刻之前的各个计时终止时刻对应的各个信息素增量,确定信息素余量。
上述信息素余量是根据
Figure PCTCN2014092714-appb-000008
确定的,extra为预估信息素增量,其取值可根据实际需要灵活设置;S206、若信息素余量大于第一预设值,则确定所述心跳特征符合心跳定包定时器的特征。
S206、若信息素余量大于第一预设值,则确定所述定时器为心跳包定时器。
S207、若所述信息素余量小于第二预设值,则确定所述定时器不为心跳包定时器。
S208、若所述信息素余量小于所述第一预设值且大于所述第二预设值,则在下一个计时终止时刻到来时,返回执行所述S201。
具体的,由于连续多次都在定时器的计时终止时刻起设备与对端设备进行了可能为心跳包的数据包的传输,该定时器才有可能为心跳包定时器,所以本实施例是需要重复执行前述步骤S201~S208;举例来说,客观时间到达 T1时刻,且T1时刻为定时器的一个计时终止时刻,则对于客观时间上的T1时刻来说,T1时刻为定时器的当前计时终止时刻,则执行前述S201~S205,可以理解的,在T1时刻之前到达的各个计时终止时刻,对于其对应的客观时间来说,也是各个当前计时终止时刻;当由T1时刻起执行前述S201~S205,确定信息素余量大于第一预设值或信息素余量小于第二预设值,则说明根据当前计时终止时刻和当前计时终止时刻之前对应的各个关联数据包,能够判断出该定时器是否为心跳包定时器,且判断的结果的准确率较高;但当信息素余量小于所述第一预设值且大于所述第二预设值,则说明根据当前计时终止时刻和当前计时终止时刻之前对应的各个关联数据包,不能以较高的准确率判断出该定时器是否为心跳包定时器,也可以说,当前时刻收集的用于以较高的准确率判断该定时器是否为心跳包定时器所需的信息(即上述各个计时终止时刻及各个计时终止时刻对应的关联数据包的处理时刻)不够全面及完整,因此还需继续收集用于以较高的准确率判断该定时器是否为心跳包定时器所需的信息,则随着客观时间的推移,在T2时刻到来时,也即在下一个计时终止时刻到来时,将该下一个计时终止时刻作为新的当前计时终止时刻,返回执行S201。
另外,为了减小设备监控设备接收和/或发送的数据包的负担,且考虑到心跳包是在各个计时终止时刻附近发送或接收的,因此本实施例是在定时器的各个计时终止时刻对应的时段内监听设备接收和/或发送的全部数据包,上述计时终止时刻对应的时段可以为一个时刻点,由于一个时刻点在微分范畴中可以细分为无线多个点,则基于一个时刻点包含无限多个点,或者由于设备内部数据处理产生的时延,导致漏监听到可能为心跳包的数据包,上述计时终止时刻对应的时段为具有一定时长的时间段。
本实施例中,考虑到在心跳包定时器的计时终止时刻,设备便会发送心跳包设备发送和/或接收数据包,因此结合设备发送和/或接收的全部数据包和定时器的各个计时终止时刻对应的各个关联数据包,可以以较高的准确率判断定时器是否为心跳包定时器,便于设备在不需要被频繁唤醒时,准确关闭心跳包定时器或延长心跳包定时器的计时时长,降低设备的功耗,且以较大可能的避免了因对定时器误判而影响了设备的其他性能的情况。
图3为本发明心跳包定时器的识别方法实施例三的流程示意图。如图 3所示,本实施例是结合前述图1或图2所示的实施例,描述了一种上述识别方法的具体应用流程,具体如下:
S301、判断定时器的描述信息中是否有记录定时器为心跳包定时器,或不为心跳包定时器;若是,则停止;若否,执行S302。
S302、在所述定时器的当前计时终止时刻到来时,判断设备是否处于唤醒状态;若否,执行S311;若是,则在下一个计时终止时刻到来时,执行S303。
由于心跳包定时器在一个计时终止时刻到来时,若该设备处于唤醒状态,则设备会直接发送心跳包,但若该设备处于睡眠状态,在心跳包定时器的计时终止时刻到来时,设备会被唤醒以发送心跳包;而上述定时器的一个计时终止时刻到来时,设备处于唤醒状态的原因可能是因为该定时器的一个计时终止时刻到来,也有可能是设备为其他应用或进程设置的心跳包定时器将设备唤醒,或者设备正在传输业务数据包,也会处于唤醒状态;但若设备处于睡眠状态,且在上述定时器的计时终止时刻到来时,设备也未被唤醒,则可确定该定时器不是心跳包定时器。
在确定上述定时器不为心跳包定时器后,执行S311,在该定时器的描述信息中记录该定时器不为心跳包定时器,则在随后的时间里,当设备需要关闭心跳包定时器或延长心跳包定时器的计时时长时,不需执行下述各个步骤对该定时器进行识别,可直接确定该定时器不为心跳包定时器。
S303、在定时器的当前计时终止时刻对应的时段内,获取设备接收和/或发送的至少一个数据包和所述至少一个数据包的套接字。
S304、根据至少一个数据包的套接字,在至少一个数据包中确定所述当前计时终止时刻对应的至少一个候选关联数据包。
S305、根据当前计时终止时刻和当前计时终止时刻对应的至少一个候选关联数据包的处理时刻,确定所述当前计时终止时刻对应的关联数据包。
S306、根据当前计时终止时刻和所述当前计时终止时刻对应的关联数据包的处理时刻,获取所述当前计时终止时刻对应的信息素增量。
S307、根据所述当前计时终止时刻对应的信息素增量和所述当前计时终止时刻之前的各个计时终止时刻对应的各个信息素增量,确定信息素余量。
S308、若信息素余量大于第一预设值,则确定所述定时器为心跳包定时 器。
执行S308后,执行S311;
S309、若所述信息素余量小于第二预设值,则确定所述定时器不为心跳包定时器。
执行S309后,执行S311;
S310、若所述信息素余量小于所述第一预设值且大于所述第二预设值,则在下一个计时终止时刻到来时,返回执行所述S303。
S311、更新定时器的描述信息。
若是执行S308后执行了S311,则更新的描述信息是该定时器为心跳包定时器;若执行S302或S309后执行了S311,则更新的描述信息是该定时器不为心跳包定时器。
本实施例中,考虑到在心跳包定时器的计时终止时刻,设备便会发送心跳包设备发送或接收数据包,因此结合设备发送和/或接收的数据包和定时器的各个计时终止时刻对应的各个关联数据包,可以以较高的准确率判断定时器是否为心跳包定时器,便于设备在不需要被频繁唤醒时,准确关闭心跳包定时器或延长心跳包定时器的计时时长,降低设备的功耗,且以较大可能的避免了因对定时器误判而影响了设备的其他性能的情况。
需要说明的是,设备可以为多个应用或进程设置至少一个定时器;设备设置的任意一个定时器均可采用前述各个方法实施例,以判断该定时器是否为心跳包定时器。
图4为本发明设备实施例一的结构示意图。如图4所示,本实施例中的设备设置了定时器,包括:
确定模块41,用于在所述设备传输的数据包中,确定所述定时器的各个计时终止时刻对应的各个关联数据包;所述关联数据包与所述定时器之间存在关联关系;所述设备传输的数据包为所述设备发送的数据包,或为所述设备接收的数据包,或为所述设备发送的数据包和接收的数据包;
判断模块42,用于根据各个关联数据包和所述定时器的各个计时终止时刻,判断所述定时器是否为所述设备为传输心跳包设置的心跳包定时器。
本实施例中,考虑到在心跳包定时器的计时终止时刻,设备便会发送心跳包设备发送或接收数据包,因此结合设备发送和/或接收的数据包和定时器 的各个计时终止时刻对应的各个关联数据包,可以以较高的准确率判断定时器是否为心跳包定时器,便于设备在不需要被频繁唤醒时,准确关闭心跳包定时器或延长心跳包定时器的计时时长,降低设备的功耗,且以较大可能的避免了因对定时器误判而影响了设备的其他性能的情况。
图5为本发明设备实施例二的结构示意图。如图5所示,本实施例是在图4所示的实施例的基础上做出进一步的描述,具体的,设备包括接收模块43和发送模块44:所述接收模块43用于接收数据包;所述发送模块44用于发送数据包;
所述确定模块41具体用于获知设备在定时器的当前计时终止时刻对应的时段内,传输的至少一个数据包和所述至少一个数据包的套接字;
所述确定模块41具体用于根据所述至少一个数据包的套接字,在所述至少一个数据包中确定所述当前计时终止时刻对应的至少一个候选关联数据包;
所述确定模块41具体用于根据所述当前计时终止时刻和所述当前计时终止时刻对应的至少一个候选关联数据包的处理时刻,确定所述当前计时终止时刻对应的关联数据包;
其中,所述当前计时终止时刻对应的关联数据包为在所述当前计时终止时刻对应的各个候选关联数据包中,处理时刻与所述当前计时终止时刻之间的差值最小的候选关联数据包;
若所述候选关联数据包为设备接收的数据包,该候选关联数据包的处理时刻为所述接收模块43接收该候选关联数据包的接收时刻;若所述候选关联数据包为设备发送的数据包,该候选关联数据包的处理时刻为所述发送模块44发送该候选关联数据包的发送时刻。
进一步的,所述判断模块42具体用于根据当前计时终止时刻和所述当前计时终止时刻对应的关联数据包的处理时刻,获取所述当前计时终止时刻对应的信息素增量;
根据所述当前计时终止时刻对应的信息素增量和所述当前计时终止时刻之前的各个计时终止时刻对应的各个信息素增量,确定信息素余量;
根据所述信息素余量,判断所述定时器是否为所述设备为传输心跳包设置的心跳包定时器。
进一步的,所述判断模块42具体用于若信息素余量大于第一预设值,则确定所述定时器为心跳包定时器;
所述判断模块42具体用于若所述信息素余量小于第二预设值,则确定所述定时器不为心跳包定时器;
所述判断模块42具体用于若所述信息素余量小于所述第一预设值且大于所述第二预设值,则在下一个计时终止时刻到来时,将所述下一个计时终止时刻作为新的当前计时终止时刻,返回执行所述获知设备在定时器的当前计时终止时刻对应的时段内,传输的至少一个数据包和所述至少一个数据包的套接字。更具体的,所述定时器的各个计时终止时刻中任意一个计时终止时刻对应的信息素增量是根据
Figure PCTCN2014092714-appb-000009
确定的;所述信息素余量surplus是根据
Figure PCTCN2014092714-appb-000010
确定的,其中,i和N均为正整数,i的取值为所述当前计时终止时刻之前的各个计时终止时刻的序号,N的取值为所述当前计时终止时刻的序号;addi为第i个计时终止时刻对应的信息素增量,deltai为第i个计时终止时刻与第i个计时终止时刻对应的关联数据包的处理时刻之间的偏移量,deltai=|whenElapsedi-netElapsedi|;whenElapsedi为第i个计时终止时刻,netElapsedi为第i个计时终止时刻对应的关联数据包的处理时刻,timeout用于表示容忍的最大偏移量,extra为预估信息素增量;THRESHOLD为第一预设值;-THRESHOLD为所述第二预设值。
本实施例中,考虑到在心跳包定时器的计时终止时刻,设备便会发送心跳包设备发送或接收数据包,因此结合设备发送和/或接收的数据包和定时器的各个计时终止时刻对应的各个关联数据包,可以以较高的准确率判断定时器是否为心跳包定时器,便于设备在不需要被频繁唤醒时,准确关闭心跳包定时器或延长心跳包定时器的计时时长,降低设备的功耗,且以较大可能的避免了因对定时器误判而影响了设备的其他性能的情况。
图6为本发明设备实施例三的结构示意图。如图6所示,本实施例中设备设置了定时器,所述设备包括:
处理器51,用于在所述设备传输的数据包中,确定所述定时器的各个计时终止时刻对应的各个关联数据包;所述关联数据包与所述定时器之间存在关联关系;所述设备传输的数据包为所述设备发送的数据包,或为所述设备接收的数据包,或为所述设备发送的数据包和接收的数据包;
所述处理器51用于根据各个关联数据包和所述定时器的各个计时终止 时刻,判断所述定时器是否为所述设备为传输心跳包设置的心跳包定时器。
本实施例中,考虑到在心跳包定时器的计时终止时刻,设备便会发送心跳包设备发送或接收数据包,因此结合设备发送和/或接收的数据包和定时器的各个计时终止时刻对应的各个关联数据包,可以以较高的准确率判断定时器是否为心跳包定时器,便于设备在不需要被频繁唤醒时,准确关闭心跳包定时器或延长心跳包定时器的计时时长,降低设备的功耗,且以较大可能的避免了因对定时器误判而影响了设备的其他性能的情况。
需要说明的是,上述设备实施例中的各个模块用于执行上述各个方法实施例中对应的各个步骤,具体实现过程及有益效果可参考前述各个方法实施例。
图7为本发明设备实施例四的结构示意图。如图7所示,本实施例是在图6所示的实施例的基础上,做出进一步的描述,本实施例中,设备还包括:发送器52和接收器53;所述发送器52用于发送数据包;所述接收器用于接收数据包;
所述处理器51具体用于获知设备在定时器的当前计时终止时刻对应的时段内,传输的至少一个数据包和所述至少一个数据包的套接字;
所述处理器51具体用于根据所述至少一个数据包的套接字,在所述至少一个数据包中确定所述当前计时终止时刻对应的至少一个候选关联数据包;
所述处理器51具体用于根据所述当前计时终止时刻和所述当前计时终止时刻对应的至少一个候选关联数据包的处理时刻,确定所述当前计时终止时刻对应的关联数据包;
其中,所述当前计时终止时刻对应的关联数据包为在所述当前计时终止时刻对应的各个候选关联数据包中,处理时刻与所述当前计时终止时刻之间的差值最小的候选关联数据包;
若所述候选关联数据包为接收器53接收的数据包,该候选关联数据包的处理时刻为所述接收器53接收该候选关联数据包的接收时刻;若所述候选关联数据包为发送器52发送的数据包,该候选关联数据包的处理时刻为所述发送器52发送该候选关联数据包的发送时刻。
所述处理器51具体用于根据当前计时终止时刻和所述当前计时终止时刻对应的关联数据包的处理时刻,获取所述当前计时终止时刻对应的信息素 增量;
所述处理器51具体用于根据所述当前计时终止时刻对应的信息素增量和所述当前计时终止时刻之前的各个计时终止时刻对应的各个信息素增量,确定信息素余量;
所述处理器51具体用于根据所述信息素余量,判断所述定时器是否为所述设备为传输心跳包设置的心跳包定时器。
所述处理器51具体用于若信息素余量大于第一预设值,则确定所述定时器为心跳包定时器;
所述处理器51具体用于若所述信息素余量小于第二预设值,则确定所述定时器不为心跳包定时器;
所述处理器51具体用于若所述信息素余量小于所述第一预设值且大于所述第二预设值,则在下一个计时终止时刻到来时,将所述下一个计时终止时刻作为新的当前计时终止时刻,返回执行所述获知设备在定时器的当前计时终止时刻对应的时段内,传输的至少一个数据包和所述至少一个数据包的套接字。更具体的,所述定时器的各个计时终止时刻中任意一个计时终止时刻对应的信息素增量是根据
Figure PCTCN2014092714-appb-000011
确定的;所述信息素余量surplus是根据
Figure PCTCN2014092714-appb-000012
确定的,其中,i和N均为正整数,i的取值为所述当前计时终止时刻之前的各个计时终止时刻的序号,N的取值为所述当前计时终止时刻的序号;addi为第i个计时终止时刻对应的信息素增量,deltai为第i个计时终止时刻与第i个计时终止时刻对应的关联数据包的处理时刻之间的偏移量,deltai=|whenElapsedi-netElapsedi|;whenElapsedi为第i个计时终止时刻,netElapsedi为第i个计时终止时刻对应的关联数据包的处理时刻,timeout用于表示容忍的最大偏移量,extra为预估信息素增量;THRESHOLD为第一预设值;-THRESHOLD为所述第二预设值。
本实施例中,考虑到在心跳包定时器的计时终止时刻,设备便会发送心跳包设备发送或接收数据包,因此结合设备发送和/或接收的数据包和定时器的各个计时终止时刻对应的各个关联数据包,可以以较高的准确率判断定时器是否为心跳包定时器,便于设备在不需要被频繁唤醒时,准确关闭心跳包定时器或延长心跳包定时器的计时时长,降低设备的功耗,且以较大可能的避免了因对定时器误判而影响了设备的其他性能的情况。
需要说明的是,上述设备实施例中的各个器件,如处理器、发送器、接 收器具体用于执行上述各个方法实施例中对应的各个步骤,具体实现过程及有益效果可参考前述各个方法实施例。
本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于一计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。

Claims (15)

  1. 一种心跳包定时器的识别方法,其特征在于,所述识别方法由设置了定时器的设备执行,包括:
    在所述设备传输的数据包中,确定所述定时器的各个计时终止时刻对应的各个关联数据包;所述关联数据包与所述定时器之间存在关联关系;所述设备传输的数据包为所述设备发送的数据包,或为所述设备接收的数据包,或为所述设备发送的数据包和接收的数据包;
    根据各个关联数据包和所述定时器的各个计时终止时刻,判断所述定时器是否为所述设备为传输心跳包设置的心跳包定时器。
  2. 根据权利要求1所述的识别方法,其特征在于,确定所述定时器的各个计时终止时刻中每一个计时终止时刻对应的关联数据包,包括:
    获知设备在定时器的当前计时终止时刻对应的时段内,传输的至少一个数据包和所述至少一个数据包的套接字;
    根据所述至少一个数据包的套接字,在所述至少一个数据包中确定所述当前计时终止时刻对应的至少一个候选关联数据包;
    根据所述当前计时终止时刻和所述当前计时终止时刻对应的至少一个候选关联数据包的处理时刻,确定所述当前计时终止时刻对应的关联数据包;
    其中,所述当前计时终止时刻对应的关联数据包为在所述当前计时终止时刻对应的各个候选关联数据包中,处理时刻与所述当前计时终止时刻之间的差值最小的候选关联数据包;
    若所述候选关联数据包为设备接收的数据包,该候选关联数据包的处理时刻为设备接收该候选关联数据包的接收时刻;若所述候选关联数据包为设备发送的数据包,该候选关联数据包的处理时刻为设备发送该候选关联数据包的发送时刻。
  3. 根据权利要求2所述的识别方法,其特征在于,根据各个关联数据包和所述定时器的各个计时终止时刻,判断所述定时器是否为所述设备为传输心跳包设置的心跳包定时器,包括:
    根据当前计时终止时刻和所述当前计时终止时刻对应的关联数据包的处理时刻,获取所述当前计时终止时刻对应的信息素增量;
    根据所述当前计时终止时刻对应的信息素增量和所述当前计时终止时刻 之前的各个计时终止时刻对应的各个信息素增量,确定信息素余量;
    根据所述信息素余量,判断所述定时器是否为所述设备为传输心跳包设置的心跳包定时器。
  4. 根据权利要求3所述的识别方法,其特征在于,根据所述信息素余量,判断所述定时器是否为所述设备为传输心跳包设置的心跳包定时器,包括:
    若信息素余量大于第一预设值,则确定所述定时器为心跳包定时器;
    若所述信息素余量小于第二预设值,则确定所述定时器不为心跳包定时器;
    若所述信息素余量小于所述第一预设值且大于所述第二预设值,则在下一个计时终止时刻到来时,将所述下一个计时终止时刻作为新的当前计时终止时刻,返回执行所述获知设备在定时器的当前计时终止时刻对应的时段内,传输的至少一个数据包和所述至少一个数据包的套接字。
  5. 根据权利要求4所述的识别方法,其特征在于,所述定时器的各个计时终止时刻中任意一个计时终止时刻对应的信息素增量是根据
    Figure PCTCN2014092714-appb-100001
    确定的;所述信息素余量surplus是根据
    Figure PCTCN2014092714-appb-100002
    确定的,其中,i和N均为正整数,i的取值为所述当前计时终止时刻之前的各个计时终止时刻的序号,N的取值为所述当前计时终止时刻的序号;addi为第i个计时终止时刻对应的信息素增量,deltai为第i个计时终止时刻与第i个计时终止时刻对应的关联数据包的处理时刻之间的偏移量,deltai=|whenElapsedi-netElapsedi|;whenElapsedi为第i个计时终止时刻,netElapsedi为第i个计时终止时刻对应的关联数据包的处理时刻,timeout用于表示容忍的最大偏移量,extra为预估信息素增量;THRESHOLD为第一预设值;-THRESHOLD为所述第二预设值。
  6. 一种设备,其特征在于,设置了定时器,所述设备包括:
    确定模块,用于在所述设备传输的数据包中,确定所述定时器的各个计时终止时刻对应的各个关联数据包;所述关联数据包与所述定时器之间存在关联关系;所述设备传输的数据包为所述设备发送的数据包,或为所述设备接收的数据包,或为所述设备发送的数据包和接收的数据包;
    判断模块,用于根据各个关联数据包和所述定时器的各个计时终止时刻,判断所述定时器是否为所述设备为传输心跳包设置的心跳包定时器。
  7. 根据权利要求6所述的设备,其特征在于,还包括:接收模块和发送 模块;
    所述确定模块具体用于获知设备在定时器的当前计时终止时刻对应的时段内,传输的至少一个数据包和所述至少一个数据包的套接字;
    所述确定模块具体用于根据所述至少一个数据包的套接字,在所述至少一个数据包中确定所述当前计时终止时刻对应的至少一个候选关联数据包;
    所述确定模块具体用于根据所述当前计时终止时刻和所述当前计时终止时刻对应的至少一个候选关联数据包的处理时刻,确定所述当前计时终止时刻对应的关联数据包;
    其中,所述当前计时终止时刻对应的关联数据包为在所述当前计时终止时刻对应的各个候选关联数据包中,处理时刻与所述当前计时终止时刻之间的差值最小的候选关联数据包;
    若所述候选关联数据包为接收模块接收的数据包,该候选关联数据包的处理时刻为所述接收模块接收该候选关联数据包的接收时刻;若所述候选关联数据包为发送模块发送的数据包,该候选关联数据包的处理时刻为所述发送模块发送该候选关联数据包的发送时刻。
  8. 根据权利要求7所述的设备,其特征在于,所述判断模块具体用于根据当前计时终止时刻和所述当前计时终止时刻对应的关联数据包的处理时刻,获取所述当前计时终止时刻对应的信息素增量;
    根据所述当前计时终止时刻对应的信息素增量和所述当前计时终止时刻之前的各个计时终止时刻对应的各个信息素增量,确定信息素余量;
    根据所述信息素余量,判断所述定时器是否为所述设备为传输心跳包设置的心跳包定时器。
  9. 根据权利要求8所述的设备,其特征在于,所述判断模块具体用于若信息素余量大于第一预设值,则确定所述定时器为所述心跳包定时器;
    所述判断模块具体用于若所述信息素余量小于第二预设值,则确定所述定时器不为所述心跳包定时器;
    所述判断模块具体用于若所述信息素余量小于所述第一预设值且大于所述第二预设值,则在下一个计时终止时刻到来时,将所述下一个计时终止时刻作为新的当前计时终止时刻,返回执行所述获知设备在定时器的当前计时终止时刻对应的时段内,传输的至少一个数据包和所述至少一个数据包的套 接字。
  10. 根据权利要求9所述的设备,其特征在于,所述定时器的各个计时终止时刻中任意一个计时终止时刻对应的信息素增量是根据
    Figure PCTCN2014092714-appb-100003
    确定的;所述信息素余量surplus是根据
    Figure PCTCN2014092714-appb-100004
    确定的,其中,i和N均为正整数,i的取值为所述当前计时终止时刻之前的各个计时终止时刻的序号,N的取值为所述当前计时终止时刻的序号;addi为第i个计时终止时刻对应的信息素增量,deltai为第i个计时终止时刻与第i个计时终止时刻对应的关联数据包的处理时刻之间的偏移量,deltai=|whenElapsedi-netElapsedi|;whenElapsedi为第i个计时终止时刻,netElapsedi为第i个计时终止时刻对应的关联数据包的处理时刻,timeout用于表示容忍的最大偏移量,extra为预估信息素增量;THRESHOLD为第一预设值;-THRESHOLD为所述第二预设值。
  11. 一种设备,其特征在于,设置了定时器,所述设备包括:
    处理器,用于在所述设备传输的数据包中,确定所述定时器的各个计时终止时刻对应的各个关联数据包;所述关联数据包与所述定时器之间存在关联关系;所述设备传输的数据包为所述设备发送的数据包,或为所述设备接收的数据包,或为所述设备发送的数据包和接收的数据包;
    所述处理器用于根据各个关联数据包和所述定时器的各个计时终止时刻,判断所述定时器是否为所述设备为传输心跳包设置的心跳包定时器。
  12. 根据权利要求11所述的设备,其特征在于,还包括:发送器和接收器;
    所述处理器具体用于获知设备在定时器的当前计时终止时刻对应的时段内,传输的至少一个数据包和所述至少一个数据包的套接字;
    所述处理器具体用于根据所述至少一个数据包的套接字,在所述至少一个数据包中确定所述当前计时终止时刻对应的至少一个候选关联数据包;
    所述处理器具体用于根据所述当前计时终止时刻和所述当前计时终止时刻对应的至少一个候选关联数据包的处理时刻,确定所述当前计时终止时刻对应的关联数据包;
    其中,所述当前计时终止时刻对应的关联数据包为在所述当前计时终止时刻对应的各个候选关联数据包中,处理时刻与所述当前计时终止时刻之间的差值最小的候选关联数据包;
    若所述候选关联数据包为接收器接收的数据包,该候选关联数据包的处理时刻为所述接收器接收该候选关联数据包的接收时刻;若所述候选关联数据包为发送器发送的数据包,该候选关联数据包的处理时刻为所述发送器发送该候选关联数据包的发送时刻。
  13. 根据权利要求12所述的设备,其特征在于,所述处理器具体用于根据当前计时终止时刻和所述当前计时终止时刻对应的关联数据包的处理时刻,获取所述当前计时终止时刻对应的信息素增量;
    所述处理器具体用于根据所述当前计时终止时刻对应的信息素增量和所述当前计时终止时刻之前的各个计时终止时刻对应的各个信息素增量,确定信息素余量;
    所述处理器具体用于根据所述信息素余量,判断所述定时器是否为所述设备为传输心跳包设置的心跳包定时器。
  14. 根据权利要求13所述的设备,其特征在于,所述处理器具体用于若信息素余量大于第一预设值,则确定所述定时器为所述心跳包定时器;
    所述处理器具体用于若所述信息素余量小于第二预设值,则确定所述定时器不为所述心跳包定时器;
    所述处理器具体用于若所述信息素余量小于所述第一预设值且大于所述第二预设值,则在下一个计时终止时刻到来时,将所述下一个计时终止时刻作为新的当前计时终止时刻,返回执行所述获知设备在定时器的当前计时终止时刻对应的时段内,传输的至少一个数据包和所述至少一个数据包的套接字。
  15. 根据权利要求14所述的设备,其特征在于,所述定时器的各个计时终止时刻中任意一个计时终止时刻对应的信息素增量是根据
    Figure PCTCN2014092714-appb-100005
    确定的;所述信息素余量surplus是根据
    Figure PCTCN2014092714-appb-100006
    确定的,其中,i和N均为正整数,i的取值为所述当前计时终止时刻之前的各个计时终止时刻的序号,N的取值为所述当前计时终止时刻的序号;addi为第i个计时终止时刻对应的信息素增量,deltai为第i个计时终止时刻与第i个计时终止时刻对应的关联数据包的处理时刻之间的偏移量,deltai=|whenElapsedi-netElapsedi|;whenElapsedi为第i个计时终止时刻,netElapsedi为第i个计时终止时刻对应的关联数据包的处理时刻,timeout用于表示容忍的最大偏移量,extra为预估信息素增量;THRESHOLD为第一预设值;-THRESHOLD为所述第二预设值。
PCT/CN2014/092714 2014-12-01 2014-12-01 心跳包定时器的识别方法和设备 WO2016086345A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
PCT/CN2014/092714 WO2016086345A1 (zh) 2014-12-01 2014-12-01 心跳包定时器的识别方法和设备
US15/532,422 US10673726B2 (en) 2014-12-01 2014-12-01 Heartbeat packet timer identification method, and device
CN201480070440.2A CN105850077B (zh) 2014-12-01 2014-12-01 心跳包定时器的识别方法和设备

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2014/092714 WO2016086345A1 (zh) 2014-12-01 2014-12-01 心跳包定时器的识别方法和设备

Publications (1)

Publication Number Publication Date
WO2016086345A1 true WO2016086345A1 (zh) 2016-06-09

Family

ID=56090799

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/092714 WO2016086345A1 (zh) 2014-12-01 2014-12-01 心跳包定时器的识别方法和设备

Country Status (3)

Country Link
US (1) US10673726B2 (zh)
CN (1) CN105850077B (zh)
WO (1) WO2016086345A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11115317B1 (en) 2018-01-05 2021-09-07 Open Invention Network Llc EMS assisted split-brain resolution in virtual network function components

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102340862A (zh) * 2010-07-26 2012-02-01 联芯科技有限公司 一种多卡终端帧同步方法及结构
CN103684911A (zh) * 2013-12-05 2014-03-26 北京奇虎科技有限公司 一种网站的在线用户统计方法和装置
CN104093199A (zh) * 2014-07-29 2014-10-08 中国联合网络通信集团有限公司 定时器设置方法和终端

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
AU2002257217A1 (en) * 2001-04-24 2002-11-05 Broadcom Corporation Alerting system, architecture and circuitry
US8065279B2 (en) * 2008-02-25 2011-11-22 International Business Machines Corporation Performance neutral heartbeat for a multi-tasking multi-processor environment
US8160078B2 (en) * 2008-05-15 2012-04-17 Telcordia Technologies, Inc. Inter-local peer group (LPG) routing method
US8619605B2 (en) * 2009-05-13 2013-12-31 Avaya Inc. Method and apparatus for maintaining port state tables in a forwarding plane of a network element
CN102404858B (zh) 2011-11-25 2014-04-02 华为技术有限公司 一种无线资源优化方法、装置及系统
US8756708B2 (en) * 2012-07-13 2014-06-17 NETFLIX Inc. System and method for detecting active streams using a heartbeat and secure stop mechanism
CN103051635B (zh) 2012-12-28 2017-05-31 宁波新然电子信息科技发展有限公司 流媒体服务器与终端间的通讯方法
CN104135571B (zh) 2014-08-12 2016-05-25 中国联合网络通信集团有限公司 心跳定时器设置方法、终端和服务器

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102340862A (zh) * 2010-07-26 2012-02-01 联芯科技有限公司 一种多卡终端帧同步方法及结构
CN103684911A (zh) * 2013-12-05 2014-03-26 北京奇虎科技有限公司 一种网站的在线用户统计方法和装置
CN104093199A (zh) * 2014-07-29 2014-10-08 中国联合网络通信集团有限公司 定时器设置方法和终端

Also Published As

Publication number Publication date
CN105850077B (zh) 2019-06-28
CN105850077A (zh) 2016-08-10
US20170272347A1 (en) 2017-09-21
US10673726B2 (en) 2020-06-02

Similar Documents

Publication Publication Date Title
JP6226348B2 (ja) ハートビートメッセージを送信するための方法、及び携帯端末
EP2757746A2 (en) Method and apparatus for controlling traffic in electronic device
US9907020B2 (en) Wake up message transmission rate
US20120191998A1 (en) Dynamic power management in a communications device
JP6672167B2 (ja) 高速休眠システムおよびプロセス
CN108551668B (zh) 信息传输方法、装置、设备及存储介质
US10484286B2 (en) Adaptive reliability protocol
CN111048086A (zh) 多设备间的语音唤醒方法、和自协商的语音唤醒方法、装置及系统
EP3190771A1 (en) Method and device for managing instant communication application program, and mobile terminal thereof
CN108809821A (zh) 一种基于消息云的即时通信方法
US20110225230A1 (en) Method and apparatus for detecting active and orphan session-based connections
US10327206B2 (en) Method and apparatus for controlling TCP packets in communication system
WO2016095323A1 (zh) 一种基于串口服务器的数据传输方法及装置
BR102012028349B1 (pt) Método para gerenciar recursos de rádio móvel para aperfeiçoamento de recepção de pacotes
WO2016086345A1 (zh) 心跳包定时器的识别方法和设备
EP3363131A1 (en) Notification systems
CN105682115A (zh) 信息处理方法及电子设备
WO2013035451A1 (ja) 通信装置、通信状態検出方法、および通信状態検出プログラム
CN114338477B (zh) 一种通信链路监控方法、装置、设备及存储介质
US8706155B1 (en) Transmission protocol modification to maximize mobile device battery life
JP2010237752A (ja) 遠隔起動装置、遠隔起動方法及び遠隔起動プログラム
US10080196B2 (en) Method and apparatus for prolonging lasting time of inactive mode
US9774566B2 (en) Communication method and mobile electronic device using the same
CN106130823B (zh) 均匀发送bfd报文的方法与系统
US12058196B1 (en) Data transfer timeout management

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14907325

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

WWE Wipo information: entry into national phase

Ref document number: 15532422

Country of ref document: US

122 Ep: pct application non-entry in european phase

Ref document number: 14907325

Country of ref document: EP

Kind code of ref document: A1