CN112202626A - Real-time data communication heartbeat packet pushing method - Google Patents

Real-time data communication heartbeat packet pushing method Download PDF

Info

Publication number
CN112202626A
CN112202626A CN202010770886.3A CN202010770886A CN112202626A CN 112202626 A CN112202626 A CN 112202626A CN 202010770886 A CN202010770886 A CN 202010770886A CN 112202626 A CN112202626 A CN 112202626A
Authority
CN
China
Prior art keywords
heartbeat
time
period
cycle
packet
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.)
Pending
Application number
CN202010770886.3A
Other languages
Chinese (zh)
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.)
Changchun Chuangshi Qilin Technology Co ltd
Original Assignee
Changchun Chuangshi Qilin Technology Co 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 Changchun Chuangshi Qilin Technology Co ltd filed Critical Changchun Chuangshi Qilin Technology Co ltd
Priority to CN202010770886.3A priority Critical patent/CN112202626A/en
Publication of CN112202626A publication Critical patent/CN112202626A/en
Pending legal-status Critical Current

Links

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
    • 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/141Setup of application sessions

Abstract

The invention provides a method for pushing a real-time data communication heartbeat packet, which comprises the following steps: after the client and the server are initially connected, the client application program automatically sends a heartbeat packet to the server, the sending period of the heartbeat packet is initially set to be preset time, the heartbeat period is continuously prolonged until the heartbeat period is prolonged to the longest supported heartbeat time of the equipment, the longest supported heartbeat time of the equipment is taken as the heartbeat period, the heartbeat packet is continuously sent to the server, and when the network is disconnected and reconnected, the client is pulled up and operated by pushing heartbeat packet information to the server again.

Description

Real-time data communication heartbeat packet pushing method
Technical Field
The invention relates to the field of application program information pushing, in particular to a method for pushing a heartbeat packet in real-time data communication.
Background
Most mobile wireless network operators eliminate corresponding items in an NAT (network address translation) table when a link has no data communication for a period of time, thereby causing link interruption. NAT timeout is an important factor affecting the lifetime of TCP (transmission control protocol) connections.
The android system has a bug in processing the DHCP (dynamic host configuration protocol), and the long connection of the TCP can be accidentally disconnected due to the fact that the DHCP cannot be actively continued and the expired IP is continuously used when the DHCP lease is over.
The conditions of switching between the mobile phone network and the WIFI network, disconnection and connection of the network and the like have network state changes, the long connection is changed into invalid connection, a network state change event needing to be monitored and responded is monitored, and the Push long connection is reestablished.
Both receiving and sending data in the network are implemented using socks. But if the socket is disconnected, there must be a problem when sending and receiving data. How to determine if this socket can still be used? We create a heartbeat mechanism in the system. The heartbeat is a self-defined structure (heartbeat packet or heartbeat frame) sent at regular time to let the opposite side know that the opposite side is on-line so as to ensure the effectiveness of the link,
the current client software can run on windows or android or ios mobile equipment, and under a heartbeat mechanism, a client sends heartbeat packets to a server at regular intervals. In addition, due to frequent packet sending, certain cpu resources are occupied, and when other large-scale applications run, bad user experiences such as halt and the like are more likely to occur, and under a mobile network, a large number of heartbeat packets can generate a signaling storm to the network of a mobile operator.
Disclosure of Invention
Aiming at the problems in the prior art, the invention provides a method for pushing a real-time data communication heartbeat packet, which comprises the following steps:
step 1: after the client establishes initial connection with the server, the client application automatically sends a heartbeat packet to the server, the sending period of the heartbeat packet is initially set as preset time, and the heartbeat period is continuously prolonged until the heartbeat period is prolonged to the longest heartbeat supporting time of the equipment;
step 2: continuously sending heartbeat packets to a server by taking the longest supported heartbeat time of the equipment as a heartbeat cycle;
and step 3: when the network is disconnected and reconnected, the heartbeat packet message is pushed to the server again, the communication process, the positioning process and the interface process are reestablished, and the client is pulled up to operate;
and 4, step 4: and restarting to send the heartbeat packet in the initial preset heartbeat period, continuously prolonging the heartbeat period again until the heartbeat period is prolonged to the longest heartbeat supporting time of the equipment, and repeating the steps.
It is preferable that: the method for determining the longest supported heartbeat time of the equipment comprises the following steps: the client records the heartbeat cycle of the last heartbeat transmission failure, and the previous cycle of the heartbeat cycle of the last heartbeat transmission failure is used as the heartbeat cycle to transmit the heartbeat, wherein the heartbeat cycle is the longest supported heartbeat time of the equipment, namely the limit heartbeat interval.
Preferably, the heartbeat cycle is initially set to a preset time of between 2 and 5 seconds. The extension time of each heartbeat cycle is any time of 1-10 seconds.
It is preferable that: the heartbeat cycle is initially set to a preset time of 2 seconds, and the extension time of each heartbeat cycle is 2 seconds.
It is preferable that: each heartbeat cycle lasts at least once.
The invention has the following beneficial effects:
1. the heartbeat packet sending period is continuously prolonged, the longest heartbeat time is supported by the probing device, and the previous heartbeat period of the heartbeat period in which the heartbeat sending fails is taken as the heartbeat period, so that the device can be ensured to be not disconnected, the sending frequency of the heartbeat packet can be reduced, the power consumption of the device is reduced, and the power consumption of the client device is obviously reduced.
2. Because the sending period of the heartbeat packet is reasonably prolonged, when the disconnection is reconnected, the heartbeat packet message is pushed to the server again to reestablish the communication process, the positioning process and the interface process, the client is pulled up to operate, the heartbeat periods of the devices are different, the heartbeat period is long, a large number of devices cannot frequently send the heartbeat packet to the server at the same time, and too many cpu resources cannot be occupied due to the disconnection and reconnection,
3. because the sending period of the heartbeat packet is reasonably prolonged, the dead halt phenomenon can be reduced when a large-scale application runs, and the pressure of the server for processing the message is obviously reduced.
4. Because the sending period of the heartbeat packets is reasonably prolonged, the probability that a large number of heartbeat packets generate signaling storm to the network of a mobile operator under the mobile network is reduced.
5. The connection state of long connection is guaranteed, and the arrival rate and the real-time performance of communication messages are improved.
Detailed Description
The present invention is described in further detail below to enable those skilled in the art to practice the invention with reference to the description.
Example 1
A real-time data communication heartbeat packet pushing method comprises the following steps:
step 1: after the client and the server establish initial connection, a client application program automatically sends a heartbeat packet to the server, the sending period of the heartbeat packet is initially set to be preset time, the heartbeat period is continuously prolonged until the heartbeat period is prolonged to the longest heartbeat supporting time of the equipment, the preset fixed period of the existing heartbeat packet of the client equipment is usually 2-5 seconds, in the embodiment, the heartbeat period is initially set to be 2 seconds, and the time for prolonging the heartbeat period can be set to be 2 seconds every time.
Step 2: continuously sending heartbeat packets to a server by taking the longest supported heartbeat time of the equipment as a heartbeat cycle;
and step 3: when the network is disconnected and reconnected, the heartbeat packet message is pushed to the server again, the communication process, the positioning process and the interface process are reestablished, and the client is pulled up to operate;
and 4, step 4: and restarting to send the heartbeat packet in the initial preset heartbeat period, continuously prolonging the heartbeat period again until the heartbeat period is prolonged to the longest heartbeat supporting time of the equipment, and repeating the steps.
The method for determining the longest supported heartbeat time of the equipment comprises the following steps: the client records the heartbeat cycle of the last heartbeat transmission failure, and the previous cycle of the heartbeat cycle of the last heartbeat transmission failure is used as the heartbeat cycle to transmit the heartbeat, wherein the heartbeat cycle is the longest supported heartbeat time of the equipment, namely the limit heartbeat interval.
Each heartbeat cycle lasts at least once.
Example 2
A real-time data communication heartbeat packet pushing method comprises the following steps:
step 1: after the client and the server establish initial connection, a client application program automatically sends a heartbeat packet to the server, the sending period of the heartbeat packet is initially set to be preset time, the heartbeat period is continuously prolonged until the heartbeat period is prolonged to the longest heartbeat supporting time of the equipment, the preset fixed period of the existing heartbeat packet of the client equipment is usually 2-5 seconds, in the embodiment, the heartbeat period is initially set to be 3 seconds, and the time for prolonging the heartbeat period can be set to be 1 second every time.
Step 2: continuously sending heartbeat packets to a server by taking the longest supported heartbeat time of the equipment as a heartbeat cycle;
and step 3: when the network is disconnected and reconnected, the heartbeat packet message is pushed to the server again, the communication process, the positioning process and the interface process are reestablished, and the client is pulled up to operate;
and 4, step 4: and restarting to send the heartbeat packet in the initial preset heartbeat period, continuously prolonging the heartbeat period again until the heartbeat period is prolonged to the longest heartbeat supporting time of the equipment, and repeating the steps.
The method for determining the longest supported heartbeat time of the equipment comprises the following steps: the client records the heartbeat cycle of the last heartbeat transmission failure, and the previous cycle of the heartbeat cycle of the last heartbeat transmission failure is used as the heartbeat cycle to transmit the heartbeat, wherein the heartbeat cycle is the longest supported heartbeat time of the equipment, namely the limit heartbeat interval.
Each heartbeat cycle lasts at least once.
Example 3
A real-time data communication heartbeat packet pushing method comprises the following steps:
step 1: after the client and the server establish initial connection, a client application program automatically sends a heartbeat packet to the server, the sending period of the heartbeat packet is initially set to be preset time, the heartbeat period is continuously prolonged until the heartbeat period is prolonged to the longest heartbeat supporting time of the equipment, the preset fixed period of the existing heartbeat packet of the client equipment is usually 2-5 seconds, in the embodiment, the heartbeat period is initially set to be 4 seconds, and the time for prolonging the heartbeat period can be set to be 7 seconds every time.
Step 2: continuously sending heartbeat packets to a server by taking the longest supported heartbeat time of the equipment as a heartbeat cycle;
and step 3: when the network is disconnected and reconnected, the heartbeat packet message is pushed to the server again, the communication process, the positioning process and the interface process are reestablished, and the client is pulled up to operate;
and 4, step 4: and restarting to send the heartbeat packet in the initial preset heartbeat period, continuously prolonging the heartbeat period again until the heartbeat period is prolonged to the longest heartbeat supporting time of the equipment, and repeating the steps.
The method for determining the longest supported heartbeat time of the equipment comprises the following steps: the client records the heartbeat cycle of the last heartbeat transmission failure, and the previous cycle of the heartbeat cycle of the last heartbeat transmission failure is used as the heartbeat cycle to transmit the heartbeat, wherein the heartbeat cycle is the longest supported heartbeat time of the equipment, namely the limit heartbeat interval.
Each heartbeat cycle lasts at least once.
Example 4
A real-time data communication heartbeat packet pushing method comprises the following steps:
step 1: after the client and the server establish initial connection, a client application program automatically sends a heartbeat packet to the server, the sending period of the heartbeat packet is initially set to be preset time, the heartbeat period is continuously prolonged until the heartbeat period is prolonged to the longest heartbeat supporting time of the equipment, the preset fixed period of the existing heartbeat packet of the client equipment is usually 2-5 seconds, in the embodiment, the heartbeat period is initially set to be 5 seconds, and the time for prolonging the heartbeat period can be set to be 10 seconds every time.
Step 2: continuously sending heartbeat packets to a server by taking the longest supported heartbeat time of the equipment as a heartbeat cycle;
and step 3: when the network is disconnected and reconnected, the heartbeat packet message is pushed to the server again, the communication process, the positioning process and the interface process are reestablished, and the client is pulled up to operate;
and 4, step 4: and restarting to send the heartbeat packet in the initial preset heartbeat period, continuously prolonging the heartbeat period again until the heartbeat period is prolonged to the longest heartbeat supporting time of the equipment, and repeating the steps.
The method for determining the longest supported heartbeat time of the equipment comprises the following steps: the client records the heartbeat cycle of the last heartbeat transmission failure, and the previous cycle of the heartbeat cycle of the last heartbeat transmission failure is used as the heartbeat cycle to transmit the heartbeat, wherein the heartbeat cycle is the longest supported heartbeat time of the equipment, namely the limit heartbeat interval.
Each heartbeat cycle lasts at least once.
After practice, it is known that the heartbeat period is initially set to a preset time of 2 seconds, and the extension time of the heartbeat period can be set to 2 seconds each time, which is a preferred embodiment.
While embodiments of the invention have been disclosed above, it is not intended to be limited to the uses set forth in the specification and examples. It can be applied to all kinds of fields suitable for the present invention. Additional modifications will readily occur to those skilled in the art. The invention is therefore not to be limited to the specific details described herein, without departing from the general concept as defined by the appended claims and their equivalents.

Claims (5)

1. A real-time data communication heartbeat packet pushing method is characterized by comprising the following steps:
step 1: after the client establishes initial connection with the server, the client application automatically sends a heartbeat packet to the server, the sending period of the heartbeat packet is initially set as preset time, and the heartbeat period is continuously prolonged until the heartbeat period is prolonged to the longest heartbeat supporting time of the equipment;
step 2: continuously sending heartbeat packets to a server by taking the longest supported heartbeat time of the equipment as a heartbeat cycle;
and step 3: when the network is disconnected and reconnected, the heartbeat packet message is pushed to the server again, the communication process, the positioning process and the interface process are reestablished, and the client is pulled up to operate;
and 4, step 4: and restarting to send the heartbeat packet in the initial preset heartbeat period, continuously prolonging the heartbeat period again until the heartbeat period is prolonged to the longest heartbeat supporting time of the equipment, and repeating the steps.
2. The method for pushing the heartbeat packet in the real-time data communication according to the claim 1, wherein: the method for determining the longest supported heartbeat time of the equipment comprises the following steps: the client records the heartbeat cycle of the last heartbeat transmission failure, and the previous cycle of the heartbeat cycle of the last heartbeat transmission failure is used as the heartbeat cycle to transmit the heartbeat, wherein the heartbeat cycle is the longest supported heartbeat time of the equipment, namely the limit heartbeat interval.
3. The method for pushing heartbeat packets in real-time data communication according to claim 2, wherein the method comprises the following steps: the heartbeat period is initially set to be between 2 and 5 seconds of a preset time. The extension time of each heartbeat cycle is any time of 1-10 seconds.
4. The method for pushing heartbeat packets in real-time data communication according to claim 3, wherein the method comprises the following steps: the heartbeat cycle is initially set to a preset time of 2 seconds, and the extension time of each heartbeat cycle is 2 seconds.
5. The method for pushing heartbeat packets in real-time data communication according to claim 3, wherein the method comprises the following steps: each heartbeat cycle lasts at least once.
CN202010770886.3A 2020-08-04 2020-08-04 Real-time data communication heartbeat packet pushing method Pending CN112202626A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010770886.3A CN112202626A (en) 2020-08-04 2020-08-04 Real-time data communication heartbeat packet pushing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010770886.3A CN112202626A (en) 2020-08-04 2020-08-04 Real-time data communication heartbeat packet pushing method

Publications (1)

Publication Number Publication Date
CN112202626A true CN112202626A (en) 2021-01-08

Family

ID=74004865

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010770886.3A Pending CN112202626A (en) 2020-08-04 2020-08-04 Real-time data communication heartbeat packet pushing method

Country Status (1)

Country Link
CN (1) CN112202626A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114390453A (en) * 2022-02-09 2022-04-22 福建天泉教育科技有限公司 Message pushing optimization method and terminal
CN115766823A (en) * 2022-10-26 2023-03-07 浪潮软件股份有限公司 Method and system for realizing disconnection reconnection of terminal APP and server based on TCP

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1997011746A1 (en) * 1995-09-29 1997-04-03 Medtronic, Inc. Adaptive search av and auto pvarp adaptation to same with additional benefit
CN103581950A (en) * 2013-11-15 2014-02-12 中国联合网络通信集团有限公司 Electronic device and heartbeat message transmitting method and system
CN103634746A (en) * 2013-12-13 2014-03-12 中国人民解放军重庆通信学院 Method and apparatus for keeping PoC continuous connection handling capacity
CN104135460A (en) * 2013-05-03 2014-11-05 华为软件技术有限公司 Method for keeping push channel active and push server
CN104207756A (en) * 2013-06-03 2014-12-17 飞比特公司 Wearable heart rate monitor
CN105307139A (en) * 2014-07-31 2016-02-03 中国电信股份有限公司 Method, mobile terminal and system for transmitting application heartbeat signals
CN105578515A (en) * 2014-10-15 2016-05-11 上海点艺信息技术有限公司 Heartbeat frequency parameter maintenance method and server
CN105577507A (en) * 2014-11-10 2016-05-11 中国移动通信集团广东有限公司 Heartbeat packet transmission interval adjustment method, device and server
CN105610913A (en) * 2015-12-22 2016-05-25 用友网络科技股份有限公司 Heartbeat keep-alive method and apparatus for long connection in communication network
CN109981384A (en) * 2017-12-27 2019-07-05 航天信息股份有限公司 A kind of system and method for dynamic adjustment heart beat cycle

Patent Citations (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1997011746A1 (en) * 1995-09-29 1997-04-03 Medtronic, Inc. Adaptive search av and auto pvarp adaptation to same with additional benefit
AU7235096A (en) * 1995-09-29 1997-04-17 Medtronic, Inc. Adaptive search av and auto pvarp adaptation to same with additional benefit
EP0794813A1 (en) * 1995-09-29 1997-09-17 Medtronic, Inc. Adaptive search av and auto pvarp adaptation to same with additional benefit
US5861007A (en) * 1995-09-29 1999-01-19 Medtronic, Inc. Adaptive search AV and auto PVARP adaptation to same with additional benefit
CN104135460A (en) * 2013-05-03 2014-11-05 华为软件技术有限公司 Method for keeping push channel active and push server
CN104207756A (en) * 2013-06-03 2014-12-17 飞比特公司 Wearable heart rate monitor
CN106073737A (en) * 2013-06-03 2016-11-09 飞比特公司 Wearable heart rate monitor
CN106333667A (en) * 2013-06-03 2017-01-18 飞比特公司 Wearable heart rate monitor
CN103581950A (en) * 2013-11-15 2014-02-12 中国联合网络通信集团有限公司 Electronic device and heartbeat message transmitting method and system
CN103634746A (en) * 2013-12-13 2014-03-12 中国人民解放军重庆通信学院 Method and apparatus for keeping PoC continuous connection handling capacity
CN105307139A (en) * 2014-07-31 2016-02-03 中国电信股份有限公司 Method, mobile terminal and system for transmitting application heartbeat signals
CN105578515A (en) * 2014-10-15 2016-05-11 上海点艺信息技术有限公司 Heartbeat frequency parameter maintenance method and server
CN105577507A (en) * 2014-11-10 2016-05-11 中国移动通信集团广东有限公司 Heartbeat packet transmission interval adjustment method, device and server
CN105610913A (en) * 2015-12-22 2016-05-25 用友网络科技股份有限公司 Heartbeat keep-alive method and apparatus for long connection in communication network
CN109981384A (en) * 2017-12-27 2019-07-05 航天信息股份有限公司 A kind of system and method for dynamic adjustment heart beat cycle

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114390453A (en) * 2022-02-09 2022-04-22 福建天泉教育科技有限公司 Message pushing optimization method and terminal
CN114390453B (en) * 2022-02-09 2023-09-08 福建天泉教育科技有限公司 Message pushing optimization method and terminal
CN115766823A (en) * 2022-10-26 2023-03-07 浪潮软件股份有限公司 Method and system for realizing disconnection reconnection of terminal APP and server based on TCP

Similar Documents

Publication Publication Date Title
CN107645529B (en) Heartbeat packet sending method and device
CN107465556B (en) Method, device and system for switching main server and standby server
WO2021077811A1 (en) Distributed denial of service (ddos) attack protection method, apparatus and system
US7515549B2 (en) Managing devices across NAT boundaries
EP3229420A1 (en) Method for establishing persistent connection between multiple smart devices and server, and smart device
CN110266810B (en) Message receiving method, device and storage medium based on MQTT protocol
CN112202626A (en) Real-time data communication heartbeat packet pushing method
KR20050086182A (en) Home network server device and the control method of the same
CN101714991B (en) Method for realizing heartbeat mechanism
KR101419579B1 (en) Method for enabling faster recovery of client applications in the event of server failure
US10594844B2 (en) Method and system for wireless network bilateral accelerated transmission
CN101656764A (en) Method, system and device for keeping session of DHCP user active
CN105450779A (en) Method for achieving connection between one household electric appliance and multiple servers
JP2010103695A (en) Cluster system, cluster server and cluster control method
CN110691398A (en) Network interaction method, system, equipment and storage medium of intelligent equipment
CN107454184B (en) Method for establishing stable network connection between Android client and server
CN103516766B (en) Method and system of communication between client-side and application server
CN105554150A (en) Network logging-in method and apparatus
CN108270593B (en) Dual-computer hot backup method and system
WO2013159492A1 (en) Method and system for reporting and downloading information
CN101304367B (en) Method, system and apparatus for monitoring survive of subscriber conversation
CN116028278A (en) Main/standby dual-machine switching method, medium and system
CN115941541A (en) Method, device, network equipment and readable storage medium for detecting network connection
CN112217649A (en) Terminal device management method, server and terminal device
CN112866133B (en) Method and device for acquiring MSS (maximum segment size)

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210108