[go: up one dir, main page]

CN107204999B - Method and device for realizing heartbeat - Google Patents

Method and device for realizing heartbeat Download PDF

Info

Publication number
CN107204999B
CN107204999B CN201610148337.6A CN201610148337A CN107204999B CN 107204999 B CN107204999 B CN 107204999B CN 201610148337 A CN201610148337 A CN 201610148337A CN 107204999 B CN107204999 B CN 107204999B
Authority
CN
China
Prior art keywords
heartbeat
application processor
packet
server
processor
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201610148337.6A
Other languages
Chinese (zh)
Other versions
CN107204999A (en
Inventor
邓秀锋
林海涛
黄佑勇
徐强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Banma Zhixing Network Hongkong Co Ltd
Original Assignee
Alibaba Group Holding Ltd
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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201610148337.6A priority Critical patent/CN107204999B/en
Publication of CN107204999A publication Critical patent/CN107204999A/en
Application granted granted Critical
Publication of CN107204999B publication Critical patent/CN107204999B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/143Termination or inactivation of sessions, e.g. event-controlled end of session
    • H04L67/145Termination or inactivation of sessions, e.g. event-controlled end of session avoiding end of session, e.g. keep-alive, heartbeats, resumption message or wake-up for inactive or interrupted session

Landscapes

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

Abstract

The invention provides a method and a device for realizing heartbeat, wherein the method comprises the following steps: the communication processor acquires parameters required by heartbeat from the application processor; and maintaining the heartbeat with the server side according to the parameters required by the heartbeat. The communication processor is adopted to replace the application processor to maintain the heartbeat with the server, and the communication processor is frequently awakened, and compared with the effect of awakening the application processor, the influence of awakening the communication processor on the power consumption has a difference of orders of magnitude, so the method provided by the invention can greatly reduce the power consumption caused by long-connection heartbeat.

Description

Method and device for realizing heartbeat
[ technical field ] A method for producing a semiconductor device
The invention relates to the technical field of computer application, in particular to a method and a device for realizing heartbeat.
[ background of the invention ]
Because network resources are limited, idle Internet links are periodically removed, and therefore, in order to maintain long connection, the terminal and the server need to periodically send information to ensure that the long connection is not removed, and the mechanism is called heartbeat. For example, various existing cloud services require a long TCP/IP connection to be maintained via a heartbeat between a client and a server. However, most of the heartbeats are managed by an AP (Application Processor), and the AP is periodically woken up by a client or an operating system to send and receive heartbeats. For example, some terminals have standby current of 5 to 10 milliamperes, and when the AP is awakened, the standby current may rise to about 200 milliamperes even if the screen is not lit. Therefore, the maintenance of the heartbeat by the AP requires frequent waking up of the AP, and generally, maintaining a long connection heartbeat by the AP increases standby power consumption.
[ summary of the invention ]
In view of the above, the present invention provides a method and an apparatus for implementing heartbeat, so as to reduce power consumption caused by long connection heartbeat.
The specific technical scheme is as follows:
the invention provides a method for realizing heartbeat, which comprises the following steps:
the communication processor acquires parameters required by heartbeat from the application processor;
and maintaining the heartbeat with the server side according to the parameters required by the heartbeat.
According to a preferred embodiment of the present invention, the parameters required for the heartbeat include: the source IP address, the source port number, the destination IP address, the destination port number of the heartbeat packet and the sending interval T of the heartbeat packet.
According to a preferred embodiment of the present invention, the parameters required for the heartbeat include: and transmitting the control parameters.
According to a preferred embodiment of the present invention, the acquiring, by the communication processor, parameters required for heartbeat from the application processor includes:
the communication processor receives a message of dormancy of the application processor;
transmission control parameters are obtained from the application processor.
According to a preferred embodiment of the invention, the method further comprises:
the communication processor receives a data packet returned by the server;
and judging whether the data packet is a heartbeat response packet or not, and if not, forwarding the data packet to an application processor.
According to a preferred embodiment of the present invention, after determining that the data packet is not a heartbeat response packet, the method further includes:
the communication processor provides transmission control parameters to the application processor.
According to a preferred embodiment of the present invention, after determining that the data packet is not a heartbeat response packet, the method further includes:
waking up the application processor.
According to a preferred embodiment of the invention, the method further comprises:
and after receiving the message that the application processor is awakened, providing the transmission control parameters to the application processor.
According to a preferred embodiment of the present invention, the communication processor starts to maintain the heartbeat with the server when the application processor is sleeping, and ends the heartbeat with the server when the application processor is awakened.
According to a preferred embodiment of the invention, the method further comprises:
after receiving a data packet or a response sent to a server from an application processor, sending the data packet or the response to the server;
and after receiving the data packet or the response sent to the client from the server, sending the data packet or the response to the application processor.
The invention also provides a method for realizing heartbeat, which comprises the following steps:
the application processor sends the parameters required by the heartbeat to the communication processor, so that the communication processor maintains the heartbeat with the server side according to the parameters required by the heartbeat.
According to a preferred embodiment of the present invention, the parameters required for the heartbeat include: the source IP address, the source port number, the destination IP address, the destination port number of the heartbeat packet and the sending interval T of the heartbeat packet.
According to a preferred embodiment of the present invention, the parameters required for the heartbeat include: and transmitting the control parameters.
According to a preferred embodiment of the present invention, the sending, by the application processor, the parameter required for heartbeat to the communication processor includes:
the application processor sends a message of self dormancy to the communication processor;
and providing parameters required by the heartbeat to the communication processor at the request of the communication processor.
According to a preferred embodiment of the invention, the method further comprises:
after the application processor is awakened, sending an awakened message to the communication processor;
and receiving the transmission control parameters provided by the communication processor.
According to a preferred embodiment of the invention, the method further comprises:
sending a data packet or a response sent to a server to the communication processor;
and receiving a data packet or response forwarded by the communication processor from a server.
The invention also provides a method for realizing heartbeat, which comprises the following steps:
the client provides parameters required by the heartbeat to the communication processor through a system module of the application processor, so that the communication processor maintains the heartbeat with the server according to the parameters required by the heartbeat.
According to a preferred embodiment of the present invention, the parameters required for the heartbeat include: the source IP address, the source port number, the destination IP address, the destination port number of the heartbeat packet and the sending interval T of the heartbeat packet.
According to a preferred embodiment of the present invention, after the client establishes the long connection with the server, the client performs the step of providing the parameters required for the heartbeat to the communication processor through the system module of the application processor.
According to a preferred embodiment of the invention, the method further comprises:
the client records the time when the application processor is dormant;
after the application processor is awakened, the client determines the time interval delta T between the current time and the last sleep time of the application processor;
and if the delta T is larger than or equal to the sending interval T of the heartbeat packet, sending the heartbeat packet sent to the server to a system module of the application processor.
The invention also provides a device for realizing heartbeat, which is arranged on the communication processor and comprises:
the parameter processing unit is used for acquiring parameters required by heartbeat from the application processor;
and the heartbeat maintaining unit is used for maintaining the heartbeat with the server side according to the parameters required by the heartbeat.
According to a preferred embodiment of the present invention, the parameters required for the heartbeat include: the source IP address, the source port number, the destination IP address, the destination port number of the heartbeat packet and the sending interval T of the heartbeat packet.
According to a preferred embodiment of the present invention, the parameters required for the heartbeat include: and transmitting the control parameters.
According to a preferred embodiment of the present invention, the parameter processing unit is specifically configured to acquire the transmission control parameter from the application processor after receiving the message that the application processor is dormant.
According to a preferred embodiment of the invention, the apparatus further comprises:
the first data processing unit is used for judging whether the data packet is a heartbeat response packet or not after receiving the data packet returned by the server side, and forwarding the data packet to the application processor if the data packet is not the heartbeat response packet; if so, the heartbeat maintenance unit is provided.
According to a preferred embodiment of the present invention, the parameter processing unit is further configured to provide the transmission control parameter to the application processor after the first data processing unit determines that the data packet is not a heartbeat response packet.
According to a preferred embodiment of the invention, the apparatus further comprises:
and the awakening unit is used for awakening the application processor after the first data processing unit judges that the data packet is not a heartbeat response packet.
According to a preferred embodiment of the present invention, the parameter processing unit is further configured to provide the transmission control parameter to the application processor after receiving the message that the application processor is woken up.
According to a preferred embodiment of the present invention, the heartbeat maintaining unit is specifically configured to start maintaining the heartbeat with the server when the application processor is sleeping, and end maintaining the heartbeat with the server when the application processor is awakened.
According to a preferred embodiment of the invention, the apparatus further comprises:
the second data processing unit is used for sending the data packet or the response to the server after receiving the data packet or the response sent to the server from the application processor; and after receiving the data packet or the response sent to the client from the server, sending the data packet or the response to the application processor.
The invention also provides a device for realizing heartbeat, which is arranged on the application processor and comprises:
and the parameter processing unit is used for sending the parameters required by the heartbeat to the communication processor so that the communication processor can maintain the heartbeat with the server side according to the parameters required by the heartbeat.
According to a preferred embodiment of the present invention, the parameters required for the heartbeat include: the source IP address, the source port number, the destination IP address, the destination port number of the heartbeat packet and the sending interval T of the heartbeat packet.
According to a preferred embodiment of the present invention, the parameters required for the heartbeat include: and transmitting the control parameters.
According to a preferred embodiment of the invention, the apparatus further comprises:
the state management unit is used for sending a message of self dormancy to the communication processor;
the parameter processing unit is specifically configured to provide the parameters required for the heartbeat to the communication processor at the request of the communication processor.
According to a preferred embodiment of the invention, the apparatus further comprises:
the state management unit is used for sending a message that the application processor is awakened to the communication processor after the application processor is awakened;
the parameter processing unit is further configured to receive the transmission control parameter provided by the communication processor.
According to a preferred embodiment of the invention, the apparatus further comprises:
the data processing unit is used for receiving the data packet or the response forwarded by the communication processor from the server; and sending the data packet or the response sent to the service end to the communication processor.
The invention also provides a device for realizing heartbeat, which is arranged at the client and comprises:
and the parameter processing unit is used for providing parameters required by the heartbeat to the communication processor through the system module of the application processor so that the communication processor maintains the heartbeat with the server according to the parameters required by the heartbeat.
According to a preferred embodiment of the present invention, the parameters required for the heartbeat include: the source IP address, the source port number, the destination IP address, the destination port number of the heartbeat packet and the sending interval T of the heartbeat packet.
According to a preferred embodiment of the present invention, the parameter processing unit is configured to execute, after the long connection is established between the client and the server, providing the parameters required by the heartbeat to the communication processor through a system module of the application processor.
According to a preferred embodiment of the invention, the apparatus further comprises:
the heartbeat management unit is used for recording the time when the application processor is dormant and the time when the application processor is awakened; and after the application processor is awakened, determining a time interval delta T between the current time and the last dormancy of the application processor, and if the delta T is greater than or equal to the sending interval T of the heartbeat packet, sending the heartbeat packet sent to the server to a system module of the application processor.
According to the technical scheme, the CP is adopted to replace the AP to maintain the heartbeat with the server side, and the CP is frequently awakened, and the influence of awakening the CP on the power consumption is smaller than the influence of awakening the AP on the power consumption, so that the power consumption caused by the long connection heartbeat can be reduced.
[ description of the drawings ]
FIG. 1 is a diagram of the system architecture upon which the present invention is based;
FIG. 2 is a flow chart of a main method provided by the embodiment of the present invention;
FIG. 3 is a flow chart of a preferred method provided by an embodiment of the present invention;
FIG. 4 is a flow chart of another preferred method provided by an embodiment of the present invention;
fig. 5 is a diagram illustrating a structure of a device disposed in a CP according to an embodiment of the present invention;
fig. 6 is a diagram illustrating a structure of a device installed in an AP according to an embodiment of the present invention;
fig. 7 is a diagram illustrating a structure of a device installed in a client according to an embodiment of the present invention.
[ detailed description ] embodiments
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in detail with reference to the accompanying drawings and specific embodiments.
The Communication Processor (CP) is a Processor in the terminal device, which is responsible for communication functions and is also called a Baseband Processor (BP), and is collectively called a CP in the embodiment of the present invention. Since the CP itself is frequently woken up and its impact on power consumption is orders of magnitude different than when the AP is woken up, the maintenance of the heartbeat is moved to the CP in the present invention.
In order to facilitate understanding of the present invention, a brief description of the system architecture on which the present invention is based will be given first. As shown in fig. 1, the system includes an AP and a CP on the terminal device side. The client runs in the AP and establishes long connection with the server, and the CP can mainly maintain the long connection heartbeat in the embodiment of the invention. That is, the CP obtains parameters required for heartbeat from the AP, and the CP maintains the heartbeat with the server according to the parameters required for the heartbeat.
Fig. 2 is a flowchart of a main method provided by an embodiment of the present invention, in which a client operates in an AP, that is, a system module of the client and a system module of the AP are both modules of the AP. As shown in fig. 2, the method mainly comprises the following steps:
after a long connection is established between the client and the server, in 201, the client sends parameters required by the heartbeat to the system module of the AP. This step is similar to the process in the prior art, and in the existing implementation manner, after the long connection between the client and the server is established, the parameter required by the heartbeat is also sent to the system module of the AP.
In 202, the system module of the AP sends parameters required for the heartbeat to the CP.
In 203, the CP maintains the heartbeat with the server according to the parameters required by the heartbeat.
After the system module of the AP sends parameters required for heartbeat to the CP, the CP may enter a sleep state, and then maintain the heartbeat with the server. The parameters required by the heartbeat may include a source IP address, a source port number, a destination IP address, a destination port number of the heartbeat packet, and a sending interval T of the heartbeat packet. The CP sends the heartbeat packet according to the parameters, that is, the heartbeat packet is sent periodically according to the sending interval T, and the source IP address, the source port number, the destination IP address and the destination port number of the heartbeat packet are all according to the contents in the parameters.
The above method is described in detail below by way of specific examples. Fig. 3 is a flowchart of a preferred method provided in the embodiment of the present invention, and similarly, a client operates in an AP, and system modules of the client and the AP all belong to the AP. As shown in fig. 3, the method may specifically comprise the steps of:
in 301, a long connection is established between a client and a server. The process specifically comprises the following steps: in 301a, the client sends a connection request to the server via the system module of the AP and the CP, respectively, and in 301b, the client receives a connection response returned by the server via the system module of the CP and the AP, respectively. The procedure for the partial long connection establishment is the same as in the prior art and is not described in detail.
In 302, the client sends parameters required for heartbeat to the system module of the AP.
The parameters required for the heartbeat may include, but are not limited to: the source IP address, the source port number, the destination IP address, the destination port number of the heartbeat packet and the sending interval T of the heartbeat packet.
In 303, the system module of the AP sends parameters required for the heartbeat to the CP.
In the prior art, after the system module of the AP obtains parameters required for heartbeat, the system module of the AP is responsible for maintaining the heartbeat with the server. In the embodiment of the present invention, the system module of the AP may enter the sleep state after sending the parameters required for heartbeat to the CP, and the CP is responsible for maintaining the heartbeat with the server.
In 304, the system module of the AP enters a sleep state.
In 305, the client records the current system time, i.e. records the time when the system module of the AP enters the sleep state.
In 306, the system module of the AP notifies the CP of the message of its sleep.
It should be noted that the execution sequence of the steps 304 to 306 is only one of the execution sequences listed in this embodiment, and any other execution sequence or simultaneous execution may be adopted. The reason why the system module of the AP notifies the CP of the sleep message is to notify the CP that the CP starts to maintain the heartbeat with the server.
In 307, the CP acquires transmission control parameters from a system module of the AP. That is, the system module of the AP provides the CP with the transmission control parameters at the request of the CP.
Since the AP and the CP share a connection, it is necessary to ensure that the AP and the CP are synchronized in the state of the connection, and this synchronization depends on the transmission control parameter control. When the AP and the CP share the TCP connection, the transmission control parameter may be a TCP synchronization parameter, in short, the sending of the data packet on the TCP connection needs to be based on and obey a certain sequence number, the AP may send the current sequence number to the CP as the transmission control parameter, and the CP may send the heartbeat packet to the server terminal according to the sequence number subsequently, for example, the previous sequence number is incremented by 1 every time the heartbeat packet is sent.
In 308, the CP maintains a heartbeat with the server. Specifically, the CP may send a heartbeat packet to the server according to the sending interval T in 308a, and receive a heartbeat response sent by the server in 308 b.
In addition, in the process of maintaining the heartbeat with the server, the CP may receive other data packets pushed by the server in addition to the heartbeat response returned by the server, and for the other data packets, the CP needs to be handed over to the AP for processing. That is, after receiving the data packet from the server, the CP may determine whether the data packet is a heartbeat response, and if so, may discard the data packet. If not, it can be performed as follows.
In 309, the CP receives a data packet sent by the server, which is not a heartbeat response.
In 310, the CP wakes up the system module of the AP. Once the system module of the AP wakes up, the CP stops maintaining the heartbeat with the server.
In 311, the CP sends transmission control parameters to the system module of the AP, where the transmission control parameters are used when the system module of the subsequent AP sends a response or a data packet to the server.
At 312, the CP transmits the data packet to the system module of the AP.
In 313, the system module of the AP sends the data packet to the client.
In 314, the client sends a response to the data packet to the system module of the AP.
In 315, the system module of the AP sends a response to the CP in accordance with the transmission control parameters.
In 316, the CP sends the response to the server, since the response is returned to the server.
If the data interaction between the client and the server is finished and the long connection needs to be maintained through heartbeat, the process may be returned to step 304.
There is also a case that after step 308, the system module of the AP is woken up (but not woken up by the CP, for example, by the user clicking a power button, for example, and then woken up by an incoming call, etc.) while the CP maintains the heartbeat with the server, and then, as shown in fig. 4, the execution may be continued 409, and after the system module of the AP is woken up, a message that the AP is woken up is sent to the CP.
In 410, the CP transmits the transmission control parameters to the system module of the AP. And after receiving the message that the AP is awakened, the CP finishes the heartbeat between the maintenance and the server. Here, the transmission control parameter may include a sequence number used by the CP to send a data packet (including a heartbeat packet) on the TCP connection, and the subsequent AP system module executes the process according to a predetermined sequence number rule when sending the data packet on the TCP connection, for example, adding 1 to the sequence number each time.
In 411, the client determines a time difference between the current time and the time when the last AP starts to sleep, and determines whether the time difference is greater than or equal to a transmission interval T of the heartbeat packet, and if not, the heartbeat packet does not need to be retransmitted; if so, a heartbeat packet needs to be sent back up to maintain the long connection, i.e., 412 is performed.
At 412, the client sends a heartbeat packet to the system module of the AP.
In 413, the system module of the AP sends a heartbeat packet to the CP according to the transmission control parameter.
At 414, the CP sends the heartbeat packet to the server, since the heartbeat packet is sent to the server.
It should be noted that, since the CP is a processor responsible for communication, the CP receives a data packet or a response sent to the server and forwards the data packet or the response to the server; when receiving the data packet or response sent to the client, the data packet or response is forwarded to the system module of the AP.
As can be seen from the above description of the method embodiment, after receiving the AP sleep message, the CP starts to actively maintain the heartbeat with the server. After receiving the message that the AP is awakened or the CP actively awakens the system module of the AP, the CP stops actively maintaining the heartbeat with the server, and returns the heartbeat with the server to the system module of the AP.
It should be noted that although there is a server in the flowchart corresponding to the above embodiment, the present invention does not require any change to the server, that is, can be adapted to the existing server.
The above is a detailed description of the method provided by the present invention, and the following is a detailed description of each apparatus provided by the present invention with reference to the examples.
Fig. 5 is a block diagram of a device disposed in a CP according to an embodiment of the present invention, where the device is configured to perform the functions of the CP in the foregoing embodiment, and as shown in fig. 5, the device may include: the parameter processing unit 01 and the heartbeat maintaining unit 02 may further include a first data processing unit 03, a wakeup unit 04, and a second data processing unit 05. The main functions of each constituent unit are as follows:
the parameter processing unit 01 is responsible for acquiring parameters required for heartbeat from the AP.
The heartbeat maintaining unit 02 is responsible for maintaining the heartbeat with the server according to the parameters required by the heartbeat.
The parameters required by the heartbeat may include, but are not limited to: the source IP address, the source port number, the destination IP address, the destination port number of the heartbeat packet and the sending interval T of the heartbeat packet. Accordingly, the parameter processing unit 01 obtains the parameters required for these heartbeats, which the AP obtains from the client and forwards.
Since the AP and the CP share one connection, it is necessary to ensure that the connection states of the AP and the CP are synchronized, and therefore, the parameters required for the heartbeat may further include a transmission control parameter. For example, when the AP and the CP share a TCP connection, the transmission control parameter may be a TCP synchronization parameter, for example, including a sequence number of a packet on the TCP connection. The AP may send the current sequence number as a transmission control parameter to the CP, and the CP may send the heartbeat packet to the server according to the sequence number when sending the heartbeat packet to the server subsequently, for example, add 1 to the previous sequence number every time of sending. Accordingly, after receiving the AP sleep message, the parameter processing unit 01 obtains the transmission control parameters from the AP.
Because the data packet returned by the server may be a heartbeat response packet or other data packets actively pushed by the server, after receiving the data packet returned by the server, the first data processing unit 03 determines whether the data packet is a heartbeat response packet, and if not, forwards the data packet to the AP; if so, it is supplied to the heartbeat maintenance unit 02.
In addition, after the first data processing unit 03 determines that the data packet is not a heartbeat response packet, the parameter processing unit 01 may provide the transmission control parameter to the AP, and wake up the AP by the wake-up unit 04, so as to return the maintenance of the heartbeat to the AP.
There is also a case where the AP is awake and then actively sends an awake message to the CP, and the parameter processing unit 01 receives the AP awake message and then provides the transmission control parameter to the AP, thereby returning the maintenance of the heartbeat to the AP.
That is, the heartbeat maintaining unit 02 starts to maintain the heartbeat with the server when the AP is in sleep, and ends the heartbeat with the server when the AP is awake.
It should be noted that, since the CP is a processor responsible for communication, the second data processing unit 05 is responsible for sending a data packet or a response to the server after receiving the data packet or the response sent to the server from the AP; and after receiving the data packet or the response sent to the client from the server, sending the data packet or the response to the AP.
Fig. 6 is a structural diagram of an apparatus disposed in an AP according to an embodiment of the present invention, configured to complete functions of a system module in the AP in the foregoing method embodiment, as shown in fig. 6, the apparatus may include a parameter processing unit 11, and may further include a state management unit 12 and a data processing unit 13. The main functions of each constituent unit are as follows:
the parameter processing unit 11 is responsible for sending parameters required by the heartbeat to the CP, so that the CP maintains the heartbeat with the server according to the parameters required by the heartbeat.
The parameters required for the above heartbeat may include, but are not limited to: the source IP address, the source port number, the destination IP address, the destination port number of the heartbeat packet and the sending interval T of the heartbeat packet. Accordingly, the parameter processing unit 11 receives the parameters required for these heartbeats from the client and transmits them to the CP.
In addition, the parameters required for the heartbeat may also include: and transmitting the control parameters. Accordingly, after the state management unit 12 sends the message of self sleep to the CP, the parameter processing unit 11 provides the transmission control parameter to the CP at the request of the CP, and the CP starts to take charge of maintaining the heartbeat with the server.
After the AP is woken up, the state management unit 12 sends a message that the AP is woken up to the CP, and then the parameter processing unit 11 receives the transmission control parameters provided by the CP, and the maintenance of the heartbeat is returned to the AP.
The data processing unit 13 is responsible for forwarding a data packet or a response to the client after receiving the data packet or the response sent to the client; after receiving the data packet or response sent to the server, the CP forwards the data packet or response.
Fig. 7 is a structural diagram of a device disposed at a client according to an embodiment of the present invention, where the device is responsible for completing functions of the client in the foregoing method embodiment, as shown in fig. 7, the device may include a parameter processing unit 21, and may further include a heartbeat management unit 22. The main functions of each constituent unit are as follows:
the parameter processing unit 21 is responsible for providing parameters required for the heartbeat to the CP via the system module of the AP, so that the CP maintains the heartbeat with the server according to the parameters required for the heartbeat.
The parameters required for the heartbeat may include, but are not limited to: the source IP address, the source port number, the destination IP address, the destination port number of the heartbeat packet and the sending interval T of the heartbeat packet. Specifically, the parameter processing unit 21 may perform providing the parameters required for the heartbeat to the CP via the system module of the AP after the client establishes the long connection with the server.
The heartbeat management unit 22 is responsible for recording the time when the AP is sleeping and the time when the AP is awakened; after the AP is awakened, the client determines the time interval delta T between the current time and the last sleep of the AP, if the delta T is larger than or equal to the sending interval T of the heartbeat packet, the heartbeat packet needs to be sent additionally to maintain long connection, namely the heartbeat packet sent to the server is sent to the AP; otherwise, the heartbeat packet does not need to be reissued.
The following application scenario is taken:
the CMNS (cloud application message notification Service) is a cloud operating system level message notification Service, is a set of system application and other applications, and is based on an open, general, and lightweight network connection protocol, and is used for a server to actively send a message notification to a specified application on a specified device.
And a long TCP connection is maintained between the CMNS server and the CMNS client through the heartbeat. Since operator network resources are limited, it is regularly cleared for idle connections, and thus a heartbeat mechanism is required to maintain long connections. In the application scenario, the above method may be adopted, and the CP of the terminal where the CMNS client is located maintains the heartbeat with the CMNS server. For the specific process, refer to the above embodiments, which are not described herein again.
In addition, the method and the device provided by the invention are applicable to any type of terminal equipment, and can include but are not limited to intelligent mobile terminals, intelligent household appliances, wearable equipment, intelligent medical equipment, PCs (personal computers) and the like. Wherein the smart mobile device may include a device such as a cell phone, a tablet computer, a notebook computer, a PDA (personal digital assistant), etc. The intelligent household appliances may include devices such as intelligent televisions, intelligent air conditioners, intelligent water heaters, intelligent refrigerators, intelligent air purifiers, and the like. Wearable devices may include devices such as smart watches, smart glasses, smart bracelets, and the like. The intelligent medical device may include, for example, an intelligent thermometer, an intelligent blood pressure meter, an intelligent blood glucose meter, and the like.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described device embodiments are merely illustrative, and for example, the division of the units is only one logical functional division, and other divisions may be realized in practice.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (38)

1. A method of implementing a heartbeat, the method comprising:
the communication processor acquires parameters required by heartbeat from the application processor;
the communication processor maintains the heartbeat with the server side according to the parameters required by the heartbeat;
the client records the time when the application processor is dormant;
if the application processor is awakened and is not awakened by the communication processor, after the application processor is awakened, the client determines the time interval delta T between the current time and the last dormancy time of the application processor;
and if the delta T is larger than or equal to the sending interval T of the heartbeat packet, sending the heartbeat packet sent to the server to the application processor.
2. The method of claim 1, wherein the parameters required for the heartbeat include: the source IP address, the source port number, the destination IP address, the destination port number of the heartbeat packet and the sending interval T of the heartbeat packet.
3. The method of claim 1, wherein the parameters required for the heartbeat include: and transmitting the control parameters.
4. The method of claim 3, wherein the communication processor obtaining parameters required for a heartbeat from an application processor comprises:
the communication processor receives a message of dormancy of the application processor;
transmission control parameters are obtained from the application processor.
5. The method of claim 1, further comprising:
the communication processor receives a data packet returned by the server;
and judging whether the data packet is a heartbeat response packet or not, and if not, forwarding the data packet to an application processor.
6. The method of claim 5, wherein after determining that the data packet is not a heartbeat response packet, the method further comprises:
the communication processor provides transmission control parameters to the application processor.
7. The method of claim 5, further comprising, after determining that the data packet is not a heartbeat response packet:
waking up the application processor.
8. The method of claim 1, further comprising:
and after receiving the message that the application processor is awakened, providing the transmission control parameters to the application processor.
9. The method according to any one of claims 1 to 8, wherein the communication processor starts to maintain the heartbeat with the server when the application processor is sleeping, and ends to maintain the heartbeat with the server when the application processor is awakened.
10. The method of any one of claims 1 to 8, further comprising:
after receiving a data packet or a response sent to a server from an application processor, sending the data packet or the response to the server;
and after receiving the data packet or the response sent to the client from the server, sending the data packet or the response to the application processor.
11. A method of implementing a heartbeat, the method comprising:
the application processor sends parameters required by heartbeat to the communication processor, so that the communication processor maintains the heartbeat with the server side according to the parameters required by the heartbeat;
the client records the time when the application processor is dormant;
if the application processor is awakened and is not awakened by the communication processor, after the application processor is awakened, the client determines the time interval delta T between the current time and the last dormancy time of the application processor;
and if the delta T is larger than or equal to the sending interval T of the heartbeat packet, sending the heartbeat packet sent to the server to the application processor.
12. The method of claim 11, wherein the parameters required for the heartbeat include: the source IP address, the source port number, the destination IP address, the destination port number of the heartbeat packet and the sending interval T of the heartbeat packet.
13. The method of claim 11, wherein the parameters required for the heartbeat include: and transmitting the control parameters.
14. The method of claim 11, wherein the sending parameters required for heartbeat from the application processor to the communication processor comprises:
the application processor sends a message of self dormancy to the communication processor;
and providing parameters required by the heartbeat to the communication processor at the request of the communication processor.
15. The method of claim 11, further comprising:
after the application processor is awakened, sending an awakened message to the communication processor;
and receiving the transmission control parameters provided by the communication processor.
16. The method of any one of claims 11 to 15, further comprising:
sending a data packet or a response sent to a server to the communication processor;
and receiving a data packet or response forwarded by the communication processor from a server.
17. A method of implementing a heartbeat, the method comprising:
the client provides parameters required by the heartbeat to the communication processor through a system module of the application processor, so that the communication processor maintains the heartbeat with the server according to the parameters required by the heartbeat;
the client records the time when the application processor is dormant;
if the application processor is awakened and is not awakened by the communication processor, after the application processor is awakened, the client determines the time interval delta T between the current time and the last dormancy time of the application processor;
and if the delta T is larger than or equal to the sending interval T of the heartbeat packet, sending the heartbeat packet sent to the server to a system module of the application processor.
18. The method of claim 17, wherein the parameters required for the heartbeat include: the source IP address, the source port number, the destination IP address, the destination port number of the heartbeat packet and the sending interval T of the heartbeat packet.
19. The method according to claim 17 or 18, wherein the client performs the step of providing the parameters required for the heartbeat to the communication processor via a system module of the application processor after establishing the long connection with the server.
20. The utility model provides a realize device of heartbeat sets up in communication processor which characterized in that, the device includes:
the parameter processing unit is used for acquiring parameters required by heartbeat from the application processor;
the heartbeat maintaining unit is used for maintaining the heartbeat with the server side according to the parameters required by the heartbeat;
the second data processing unit is used for sending the heartbeat packet received from the application processor to the server; the client records the time when the application processor is dormant; if the application processor is awakened and is not awakened by the communication processor, after the application processor is awakened, the client determines the time interval delta T between the current time and the last dormancy time of the application processor; and if the delta T is larger than or equal to the sending interval T of the heartbeat packet, sending the heartbeat packet sent to the server to the application processor.
21. The apparatus of claim 20, wherein the parameters required for the heartbeat include: the source IP address, the source port number, the destination IP address, the destination port number of the heartbeat packet and the sending interval T of the heartbeat packet.
22. The apparatus of claim 20, wherein the parameters required for the heartbeat include: and transmitting the control parameters.
23. The apparatus of claim 22, wherein the parameter processing unit is specifically configured to obtain the transmission control parameter from the application processor after receiving the message that the application processor is dormant.
24. The apparatus of claim 20, further comprising:
the first data processing unit is used for judging whether the data packet is a heartbeat response packet or not after receiving the data packet returned by the server side, and forwarding the data packet to the application processor if the data packet is not the heartbeat response packet; if so, the heartbeat maintenance unit is provided.
25. The apparatus of claim 24, wherein the parameter processing unit is further configured to provide transmission control parameters to the application processor after the first data processing unit determines that the data packet is not a heartbeat response packet.
26. The apparatus of claim 24, further comprising:
and the awakening unit is used for awakening the application processor after the first data processing unit judges that the data packet is not a heartbeat response packet.
27. The apparatus of claim 20, wherein the parameter processing unit is further configured to provide transmission control parameters to the application processor after receiving a message that the application processor is woken up.
28. The apparatus according to any of the claims 20 to 27, wherein the heartbeat maintaining unit is specifically configured to start maintaining a heartbeat with the server when the application processor is sleeping, and end maintaining a heartbeat with the server when the application processor is awakened.
29. The apparatus of any one of claims 20 to 27, further comprising:
the second data processing unit is used for sending the data packet or the response to the server after receiving the data packet or the response sent to the server from the application processor; and after receiving the data packet or the response sent to the client from the server, sending the data packet or the response to the application processor.
30. A device for realizing heartbeat is arranged on an application processor, and is characterized by comprising:
the parameter processing unit is used for sending parameters required by heartbeat to the communication processor so that the communication processor can maintain the heartbeat with the server side according to the parameters required by the heartbeat;
the data processing unit is used for sending the heartbeat packet received from the client to the communication processor; the client records the time when the application processor is dormant; if the application processor is awakened and is not awakened by the communication processor, after the application processor is awakened, the client determines the time interval delta T between the current time and the last dormancy time of the application processor; and if the delta T is larger than or equal to the sending interval T of the heartbeat packet, sending the heartbeat packet sent to the server to the application processor.
31. The apparatus of claim 30, wherein the parameters required for the heartbeat include: the source IP address, the source port number, the destination IP address, the destination port number of the heartbeat packet and the sending interval T of the heartbeat packet.
32. The apparatus of claim 30, wherein the parameters required for the heartbeat include: and transmitting the control parameters.
33. The apparatus of claim 32, further comprising:
the state management unit is used for sending a message of self dormancy to the communication processor;
the parameter processing unit is specifically configured to provide the parameters required for the heartbeat to the communication processor at the request of the communication processor.
34. The apparatus of claim 30, further comprising:
the state management unit is used for sending a message that the application processor is awakened to the communication processor after the application processor is awakened;
the parameter processing unit is further configured to receive the transmission control parameter provided by the communication processor.
35. The apparatus of any one of claims 30 to 34, further comprising:
the data processing unit is used for receiving the data packet or the response forwarded by the communication processor from the server; and sending the data packet or the response sent to the service end to the communication processor.
36. The utility model provides a realize device of heartbeat, sets up in the customer end, its characterized in that, the device includes:
the parameter processing unit is used for providing parameters required by the heartbeat to the communication processor through a system module of the application processor so that the communication processor can maintain the heartbeat with the server side according to the parameters required by the heartbeat;
the heartbeat management unit is used for recording the time when the application processor is dormant and the time when the application processor is awakened; if the application processor is awakened and is not awakened by the communication processor, after the application processor is awakened, determining a time interval delta T between the current time and the last dormancy of the application processor, and if the delta T is larger than or equal to the sending interval T of the heartbeat packet, sending the heartbeat packet sent to the server to a system module of the application processor.
37. The apparatus of claim 36, wherein the parameters required for the heartbeat include: the source IP address, the source port number, the destination IP address, the destination port number of the heartbeat packet and the sending interval T of the heartbeat packet.
38. The apparatus according to claim 36 or 37, wherein the parameter processing unit is configured to perform providing the parameters required for the heartbeat to the communication processor via a system module of the application processor after the client establishes the long connection with the server.
CN201610148337.6A 2016-03-16 2016-03-16 Method and device for realizing heartbeat Active CN107204999B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610148337.6A CN107204999B (en) 2016-03-16 2016-03-16 Method and device for realizing heartbeat

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610148337.6A CN107204999B (en) 2016-03-16 2016-03-16 Method and device for realizing heartbeat

Publications (2)

Publication Number Publication Date
CN107204999A CN107204999A (en) 2017-09-26
CN107204999B true CN107204999B (en) 2020-10-30

Family

ID=59903623

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610148337.6A Active CN107204999B (en) 2016-03-16 2016-03-16 Method and device for realizing heartbeat

Country Status (1)

Country Link
CN (1) CN107204999B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108768763A (en) * 2018-05-04 2018-11-06 北京小米移动软件有限公司 Heartbeat message sending method and device
CN110891328B (en) * 2018-09-07 2022-04-12 华为技术有限公司 Method and mobile device for aligning wake-up
CN109461238A (en) * 2018-10-30 2019-03-12 北京摩拜科技有限公司 Control method for vehicle, server, vehicle and Vehicular system
CN110557301B (en) * 2019-08-23 2023-07-28 福建科立讯通信有限公司 Method for realizing server-side heartbeat detection mechanism for reducing power consumption
CN110536019B (en) * 2019-09-05 2021-02-19 深圳市智微智能科技股份有限公司 High-stability timing awakening method and device
CN112738817B (en) * 2019-10-28 2022-08-19 西安华为技术有限公司 Method and network device for keeping alive service connection of mobile device
CN112820094B (en) * 2019-11-15 2023-08-04 阿里巴巴集团控股有限公司 Control method, control equipment, control system and storage medium
CN111083014A (en) * 2019-12-19 2020-04-28 杭州情咖网络技术有限公司 Communication connection confirmation method, device and user terminal
CN111371639B (en) * 2020-02-21 2021-12-14 腾讯科技(深圳)有限公司 Network delay analysis method and device, storage medium and computer equipment
CN115225690B (en) * 2022-06-22 2024-04-19 中科驭数(北京)科技有限公司 TCP long connection keep-alive method and device based on hardware protocol stack

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102036349A (en) * 2009-09-29 2011-04-27 联想(北京)有限公司 Method for maintaining connection of terminal and network server, terminal and network server
CN103843418A (en) * 2013-10-29 2014-06-04 华为终端有限公司 Method of service agent, modem and terminal

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103458436B (en) * 2012-05-31 2016-08-03 中兴通讯股份有限公司 The detection method of link keep-alive and device between AC and AP
WO2013181812A1 (en) * 2012-06-06 2013-12-12 华为终端有限公司 Method and terminal for managing application

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102036349A (en) * 2009-09-29 2011-04-27 联想(北京)有限公司 Method for maintaining connection of terminal and network server, terminal and network server
CN103843418A (en) * 2013-10-29 2014-06-04 华为终端有限公司 Method of service agent, modem and terminal

Also Published As

Publication number Publication date
CN107204999A (en) 2017-09-26

Similar Documents

Publication Publication Date Title
CN107204999B (en) Method and device for realizing heartbeat
CN103270466B (en) Via timer related tasks being coordinated and selectively operated power management
US10552216B2 (en) Application heartbeat period adjusting method and apparatus, and terminal
KR101840245B1 (en) A method for transmitting a heartbeat message and a mobile terminal
CN103916879A (en) Equipment discovery method, apparatus and system
CN110636478A (en) Bluetooth Mesh network system, communication method, device and storage medium thereof
CN103765377B (en) Terminal and its application management method
CN108541013B (en) Information processing method, device, mobile terminal, and computer-readable storage medium
EP3190771B1 (en) Method and device for managing instant communication application program, and mobile terminal thereof
US9288269B2 (en) Network presence offload
CN107491160A (en) A kind of application method of dual operating systems, storage device and intelligent terminal
CN109474975A (en) A kind of method and terminal, platform of internet of things of networking
CN113285884B (en) Flow control method and system
CN111417182A (en) Data transmission method, device, storage medium, processor and system
KR102020358B1 (en) Terminal and method for synchronizing application thereof
CN110362395B (en) Background program management method and device, computer equipment and storage medium
WO2024120230A1 (en) Network device management method and apparatus and storage medium
WO2017016335A1 (en) Method, system, and server for eliminating message prompt
US10772041B2 (en) Beacon signal processing system
US9918275B2 (en) Method and system for waking sleeping trunking terminal up
WO2023206821A1 (en) Method and apparatus for waking up dormant node in mesh network, and device
CN103415031A (en) Method and device for heart beat reminding
CN104572240A (en) Control method and electronic equipment
US11653307B2 (en) Modifying idle mode DRX on wireless devices
CN114666779B (en) Device connection method, device, computer device, and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20201111

Address after: Room 603, 6 / F, Roche Plaza, 788 Cheung Sha Wan Road, Kowloon, China

Patentee after: Zebra smart travel network (Hong Kong) Limited

Address before: A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands

Patentee before: Alibaba Group Holding Ltd.