CN113422780A - Heartbeat interval adjusting method and device based on TCP (Transmission control protocol) long connection - Google Patents

Heartbeat interval adjusting method and device based on TCP (Transmission control protocol) long connection Download PDF

Info

Publication number
CN113422780A
CN113422780A CN202110752857.9A CN202110752857A CN113422780A CN 113422780 A CN113422780 A CN 113422780A CN 202110752857 A CN202110752857 A CN 202110752857A CN 113422780 A CN113422780 A CN 113422780A
Authority
CN
China
Prior art keywords
heartbeat
value
current
server
received
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
CN202110752857.9A
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.)
Dilu Technology Co Ltd
Original Assignee
Dilu 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 Dilu Technology Co Ltd filed Critical Dilu Technology Co Ltd
Priority to CN202110752857.9A priority Critical patent/CN113422780A/en
Publication of CN113422780A publication Critical patent/CN113422780A/en
Pending legal-status Critical Current

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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/163In-band adaptation of TCP data exchange; In-band control procedures

Abstract

The invention discloses a heartbeat interval adjusting method and a heartbeat interval adjusting device based on TCP (Transmission control protocol) long connection, wherein the method comprises the following steps: step 1, setting a heartbeat clock according to a current heartbeat value; step 2, in the time of the heartbeat clock, if the request of the server is not received, the client sends the heartbeat to the server when the time of the heartbeat clock is over; step 3, if the return of the server is received, judging whether the stable heartbeat count reaches a preset threshold value, if so, adjusting the current heartbeat value and returning to the step 1; step 4, if the return of the server is not received, the number of times of sending heartbeats to the server reaches the standard number of times, and then the connection is disconnected; and 5, after the current heartbeat value is adjusted downwards, returning to the step 1. By adopting the technical scheme, the heartbeat interval time is continuously adjusted according to the network environment condition between the two communication parties, and is continuously close to the NAT time, so that the waste of network and equipment resources is avoided.

Description

Heartbeat interval adjusting method and device based on TCP (Transmission control protocol) long connection
Technical Field
The invention relates to the technical field of communication, in particular to a heartbeat interval adjusting method and device based on long connection of a TCP (transmission control protocol).
Background
The TCP (Transmission Control Protocol) Protocol, i.e. the Transmission Control Protocol, is now widely used in the field of network communication technology. The keep-alive mechanism in TCP is a mechanism for ensuring the survival of the other party (communication connection fails or the other party no longer feeds back information) by sending a heartbeat packet (keep-alive detection message) when communication or data transmission is not performed for a long time between the two parties using the TCP protocol for communication.
In the keep-alive mechanism scheme adopted in the prior art, the time interval for sending the heartbeat packet is fixed and cannot be adjusted according to the actual application condition. Under a domestic mobile Network environment, local operators have great difference in NAT (Network Address Translation) time under different Network types, and TCP connection is interrupted after NAT overtime. Although the fixed heartbeat interval time is relatively simple in implementation, in order to avoid NAT timeout, the heartbeat interval can only be set to be the shortest time shorter than the NAT timeout time in all network environments, but resources such as a device CPU, electric quantity, network traffic and the like cannot be saved to the greatest extent.
Disclosure of Invention
The purpose of the invention is as follows: the invention aims to provide a heartbeat interval adjusting method and device based on long connection of a TCP (transmission control protocol).
The technical scheme is as follows: the invention provides a heartbeat interval adjusting method based on long connection of a TCP (Transmission control protocol), which comprises the following steps of:
step 1, setting a heartbeat clock according to a current heartbeat value, and timing;
step 2, in the time of a heartbeat clock, if the request of the server is not received, the client sends the heartbeat to the server when the time of the heartbeat clock is over, whether the return of the server is received or not is judged, and the step 3 or the step 4 is carried out according to whether the return is received or not;
step 3, if the return of the server is received, increasing a fixed value for the stable heartbeat count, judging whether the stable heartbeat count reaches a preset threshold value, and if not, returning to the step 1; if the current heartbeat value is reached, resetting the stable heartbeat count, and returning to the step 1 after the current heartbeat value is adjusted upwards;
step 4, if the return of the server is not received, judging the number of times of sending the heartbeat to the server by the client, if the number of times of sending the heartbeat to the server does not reach the standard number of times, continuing to send the heartbeat, and entering the step 3 or re-executing the step 4 according to whether the return is made; if the standard times are reached, disconnecting the connection;
and 5, resetting the stable heartbeat count after disconnection, and returning to the step 1 after the current heartbeat value is reduced.
Specifically, the step 1 includes: setting an initial most careful hop value, an initial maximum hop value, a current heart hop value, a current most careful hop value and a current maximum heart hop value, wherein the current heart hop value takes a value between the initial most careful hop value and the initial maximum heart hop value, and a TCP (transmission control protocol) long connection is established between a client and a server.
Specifically, the step 2 includes: and in the time of one heartbeat clock, if a request of the server is received, returning to the step 1.
Specifically, the step of adjusting the current heartbeat value includes: determining whether to adjust the current heartbeat value according to the numerical relationship between the current heartbeat value and the current maximum heartbeat value;
if the current heartbeat value is adjusted, the current heartbeat value is calculated by adopting the following formula:
currentMinH=curentH,
curentH=(currentMinH+currentMaxH)/2;
where currenth represents the current heartbeat value, currentMinH represents the current most careful heartbeat value, and currentMaxH represents the current maximum heartbeat value.
Specifically, the down-regulating the current heartbeat value includes: the current heartbeat value is calculated using the following formula:
currentMaxH=curentH,
curentH=(currentMinH+currentMaxH)/2。
the invention also provides a heartbeat interval adjusting device based on the long connection of the TCP protocol, which comprises: set up unit, heartbeat sending unit, heartbeat up-regulation unit, disconnect unit and heartbeat down-regulation unit, wherein:
the setting unit is used for setting a heartbeat clock according to the current heartbeat value and timing;
the heartbeat sending unit is used for sending a heartbeat to the server and judging whether a return of the server is received or not when the time of the heartbeat clock is over if the request of the server is not received within the time of one heartbeat clock;
the heartbeat up-regulation unit is used for increasing a stable heartbeat count by a fixed value if a return of the server is received, judging whether the stable heartbeat count reaches a preset threshold value, and if not, setting the unit to start running; if the current heartbeat value is reached, resetting the stable heartbeat count, and setting the unit to start running after the current heartbeat value is adjusted upwards;
the connection disconnection unit is used for judging the number of times of sending heartbeats to the server if the return of the server is not received, continuing sending heartbeats if the number of times of sending heartbeats does not reach the standard number of times, and starting to run the heartbeat up-regulation unit or running the connection disconnection unit again according to whether the return is made or not; if the standard times are reached, disconnecting the connection;
and the heartbeat down-regulation unit is used for stabilizing the heartbeat count and clearing after disconnection, and the setting unit starts to operate after the current heartbeat value is down-regulated.
Specifically, the setting unit is configured to set an initial maximum heartbeat value, a current maximum heartbeat value, and a current maximum heartbeat value, where the current heartbeat value takes a value between the initial maximum heartbeat value and the initial maximum heartbeat value, and a long TCP protocol connection is established between the server and the server.
Specifically, the heartbeat sending unit is configured to set the unit to start operating if a request of the server is received within a time of a heartbeat clock.
Specifically, the heartbeat up-regulation unit is configured to determine whether to regulate the current heartbeat value according to a numerical relationship between the current heartbeat value and the current maximum heartbeat value;
if the current heartbeat value is adjusted, the current heartbeat value is calculated by adopting the following formula:
currentMinH=curentH,
curentH=(currentMinH+currentMaxH)/2;
where currenth represents the current heartbeat value, currentMinH represents the current most careful heartbeat value, and currentMaxH represents the current maximum heartbeat value.
Specifically, the heartbeat down-regulation unit is configured to calculate a current heartbeat value by using the following formula:
currentMaxH=curentH,
curentH=(currentMinH+currentMaxH)/2。
has the advantages that: compared with the prior art, the invention has the following remarkable advantages: according to the communication information receiving and sending condition and the network environment condition between the two communication parties, the heartbeat interval time is continuously adjusted, so that the heartbeat interval time is continuously close to the NAT time under the condition that the NAT time is not exceeded, and the waste of network and equipment resources is avoided.
Drawings
Fig. 1 is a schematic flow chart of a heartbeat interval adjustment method based on a long connection of a TCP protocol according to the present invention.
Detailed Description
The technical scheme of the invention is further explained by combining the attached drawings. Fig. 1 is a schematic flow chart of a heartbeat interval adjustment method based on a long connection of a TCP protocol according to the present invention.
And step 1, setting a heartbeat clock according to the current heartbeat value, and timing.
In the embodiment of the invention, the initial most careful jump value, the initial maximum heartbeat value, the current most careful jump value and the current maximum heartbeat value are set, the current heartbeat value takes a value between the initial most careful jump value and the initial maximum heartbeat value, and the long connection of the TCP protocol is established between the client and the server.
In the specific implementation, the long connection, also called persistent connection, is not immediately disconnected after the TCP layer handshake is successful, and multiple information (including heartbeat) interactions are performed on the basis of the connection until any one party (client or server) of the connection actively disconnects, which is called a complete long connection. The keep-alive mechanism can disconnect the connection when any one of the connected parties has information intersection obstacle, so as to avoid resource waste.
In a specific implementation, in a domestic mobile communication environment, an IP Address allocated to a mobile phone terminal by an operator is an intranet IP Address of the operator, and a Network Address Translation (NAT) needs to be performed by the gateway of the operator when the mobile phone is connected to a Network, that is, the gateway of the operator needs to maintain a corresponding relationship between an extranet IP and a port to an intranet IP and a port, so as to ensure that the mobile phone in the intranet can communicate with a Network server. The method comprises the steps that when a domestic mobile wireless network operator does not have data communication in a link for a period of time, corresponding items in an NAT table are eliminated, and link interruption is caused, so that a heartbeat interval applicable to a TCP long connection keep-alive mechanism is smaller than NAT overtime time, that is, the link has data communication and is not eliminated and interrupted, if the NAT overtime time is exceeded, heartbeat is not carried out, the TCP long connection link is interrupted due to the fact that the operator eliminates the corresponding items in the NAT table, and connection between a network server and a mobile phone is disconnected.
In the specific implementation, because the NAT time of each operator in different network types is unknown, the technical scheme provided by the present invention is applicable in order to enable the heartbeat interval time to continuously approach the NAT time in the current network environment, and avoid the waste of network and device resources caused by sending heartbeats for multiple times.
In specific implementation, a current heartbeat value can be taken from the range between an initial most careful heartbeat value and an initial maximum heartbeat value, a heartbeat clock is set according to the current heartbeat value, the heartbeat clock is a time interval for sending heartbeats, the current heartbeat value can be adjusted according to a communication connection condition, specific numerical value adjustment is carried out according to the current most careful heartbeat value and the current maximum heartbeat value, and the NAT timeout time is continuously approached. The initial most careful hop value may be 60 seconds, the initial maximum heartbeat value may be 600 seconds, the current heartbeat value may be 120 seconds, the current most careful hop value may be 60 seconds, the current maximum heartbeat value may be 600 seconds, and other values may be taken from the heartbeat values to match the currently applied network environment.
And 2, in the time of one heartbeat clock, if the request of the server is not received, sending the heartbeat to the server by the client when the time of the heartbeat clock is over, judging whether the return of the server is received, and entering the step 3 or the step 4 according to whether the return is received.
In the embodiment of the invention, within the time of one heartbeat clock, if the request of the server is received, the step 1 is returned.
In specific implementation, when the client receives a request from the server within the time of the heartbeat clock, the TCP link is not interrupted, and the NAT timeout time may be recalculated, so step 1 is entered, that is, the heartbeat clock is cleared, and the heartbeat time is restarted.
In specific implementation, if the heartbeat clock is timed out and no information communication exists between the server and the client, a heartbeat packet needs to be sent to ensure that data exists in a TCP link, so that the link interruption caused by NAT timeout is avoided. And judging whether the current heartbeat value corresponding to the heartbeat clock at the moment needs to be correspondingly adjusted according to whether the condition returned by the server side is received or not.
Step 3, if the return of the server is received, increasing a fixed value for the stable heartbeat count, judging whether the stable heartbeat count reaches a preset threshold value, and if not, returning to the step 1; and if so, resetting the stable heartbeat count, and returning to the step 1 after the current heartbeat value is adjusted upwards.
In specific implementation, if a return of the server is received, it can already be shown that the current heartbeat value is smaller than the NAT timeout time, and since adjustment of the current heartbeat value is subsequently involved, in order to further clarify and avoid misadjustment caused by interference of other factors, a stable heartbeat count is set, the stable heartbeat count can start counting when the client receives the return of the server for the heartbeat, a fixed value is added, and the step 1 is returned when the count does not reach a predetermined threshold; and under the condition that the count reaches a preset threshold, for example, a fixed numerical value is 1, the stable heartbeat count is added with 1 each time the return of the server is received, and the preset threshold is 2, the stable heartbeat count can be cleared when the stable heartbeat count reaches 2, the current heartbeat value is adjusted upwards to be close to the NAT timeout time, and then the step 1 is returned.
In the embodiment of the present invention, the up-regulating the current heartbeat value includes:
determining whether to adjust the current heartbeat value according to the numerical relationship between the current heartbeat value and the current maximum heartbeat value;
if the current heartbeat value is adjusted, the current heartbeat value is calculated by adopting the following formula:
currentMinH=curentH,
curentH=(currentMinH+currentMaxH)/2;
where currenth represents the current heartbeat value, currentMinH represents the current most careful heartbeat value, and currentMaxH represents the current maximum heartbeat value.
In specific implementation, according to a numerical relationship between the current heartbeat value and the current maximum heartbeat value, it may be determined whether a difference between the current maximum heartbeat value and the current heartbeat value is within a specific range, for example, currentMaxH-currenth < ═ 10s, and if the difference is within the specific range, it indicates that the current heartbeat value has reached a stable state, and is very close to the NAT timeout time, and no adjustment is required; if not, indicating that the current heartbeat value has not reached a steady state, the current heartbeat value may be recalculated using bisection.
In the specific implementation, the current heartbeat value is calculated by adopting the dichotomy, so that the NAT timeout time can be quickly approached, and compared with a fixed value stepping mode, the method has the advantages that the calculation times required for approaching the NAT timeout time are obviously reduced, the approximation degree of the NAT timeout time on the value is higher, and the difference on the value is smaller.
Step 4, if the return of the server is not received, judging the number of times of sending the heartbeat to the server by the client, if the number of times of sending the heartbeat to the server does not reach the standard number of times, continuing to send the heartbeat, and entering the step 3 or re-executing the step 4 according to whether the return is made; if the standard number of times has been reached, the connection is disconnected.
In specific implementation, if the return of the server is not received, it may already be indicated that the current heartbeat value is greater than the NAT timeout time, since adjustment of the current heartbeat value is subsequently involved, in order to further clarify and avoid misadjustment caused by interference of other factors, the client sends the heartbeat again according to the heartbeat clock, and if the heartbeat is sent again and the return of the server is received, it indicates that the return of the server is not received by the previous heartbeat and may be interfered by other factors, step 3 may be entered; if the heartbeat is sent again and the return of the server is still not received, the step 4 is entered, the number of times of not receiving the heartbeat return can be judged, if the number of times reaches the standard number, the current heartbeat value is larger than the NAT timeout time, the TCP link is already interrupted due to the NAT timeout, and the connection can be disconnected at the moment.
And 5, resetting the stable heartbeat count after disconnection, and returning to the step 1 after the current heartbeat value is reduced.
In a specific implementation, the stable heartbeat count is cleared because the current heartbeat value needs to be adjusted. And then, after the current heartbeat value is adjusted downwards to approach the NAT timeout time, returning to the step 1, and adjusting the current heartbeat value again through the flow steps until the current heartbeat value is stable, so as to approach the NAT timeout time.
In the embodiment of the present invention, the down-regulating of the current heartbeat value includes:
the current heartbeat value is calculated using the following formula:
currentMaxH=curentH,
curentH=(currentMinH+currentMaxH)/2。
in specific implementation, the current heartbeat value is adjusted downwards and is calculated by using dichotomy calculation, and the current heartbeat value is close to the NAT timeout time quickly.
The invention also provides a heartbeat interval adjusting device based on the long connection of the TCP protocol, which comprises: set up unit, heartbeat sending unit, heartbeat up-regulation unit, disconnect unit and heartbeat down-regulation unit, wherein:
the setting unit is used for setting a heartbeat clock according to the current heartbeat value and timing;
the heartbeat sending unit is used for sending a heartbeat to the server and judging whether a return of the server is received or not when the time of the heartbeat clock is over if the request of the server is not received within the time of one heartbeat clock;
the heartbeat up-regulation unit is used for increasing a stable heartbeat count by a fixed value if a return of the server is received, judging whether the stable heartbeat count reaches a preset threshold value, and if not, setting the unit to start running; if the current heartbeat value is reached, resetting the stable heartbeat count, and setting the unit to start running after the current heartbeat value is adjusted upwards;
the connection disconnection unit is used for judging the number of times of sending heartbeats to the server if the return of the server is not received, continuing sending heartbeats if the number of times of sending heartbeats does not reach the standard number of times, and starting to run the heartbeat up-regulation unit or running the connection disconnection unit again according to whether the return is made or not; if the standard times are reached, disconnecting the connection;
and the heartbeat down-regulation unit is used for stabilizing the heartbeat count and clearing after disconnection, and the setting unit starts to operate after the current heartbeat value is down-regulated.
In the embodiment of the present invention, the setting unit is configured to set an initial maximum heartbeat value, a current maximum heartbeat value, and a current maximum heartbeat value, where the current heartbeat value takes a value between the initial maximum heartbeat value and the initial maximum heartbeat value, and a long TCP protocol connection is established between the server and the server.
In the embodiment of the present invention, the heartbeat sending unit is configured to set the unit to start operating if a request of the server is received within a time of a heartbeat clock.
In the embodiment of the present invention, the heartbeat up-regulation unit is configured to determine whether to regulate the current heartbeat value according to a numerical relationship between the current heartbeat value and the current maximum heartbeat value;
if the current heartbeat value is adjusted, the current heartbeat value is calculated by adopting the following formula:
currentMinH=curentH,
curentH=(currentMinH+currentMaxH)/2;
where currenth represents the current heartbeat value, currentMinH represents the current most careful heartbeat value, and currentMaxH represents the current maximum heartbeat value.
In the embodiment of the present invention, the heartbeat down-regulation unit is configured to calculate the current heartbeat value by using the following formula:
currentMaxH=curentH,
curentH=(currentMinH+currentMaxH)/2。

Claims (10)

1. a heartbeat interval adjusting method based on long connection of a TCP (Transmission control protocol) is characterized by comprising the following steps:
step 1, setting a heartbeat clock according to a current heartbeat value, and timing;
step 2, in the time of a heartbeat clock, if the request of the server is not received, the client sends the heartbeat to the server when the time of the heartbeat clock is over, whether the return of the server is received or not is judged, and the step 3 or the step 4 is carried out according to whether the return is received or not;
step 3, if the return of the server is received, increasing a fixed value for the stable heartbeat count, judging whether the stable heartbeat count reaches a preset threshold value, and if not, returning to the step 1; if the current heartbeat value is reached, resetting the stable heartbeat count, and returning to the step 1 after the current heartbeat value is adjusted upwards;
step 4, if the return of the server is not received, judging the number of times of sending the heartbeat to the server by the client, if the number of times of sending the heartbeat to the server does not reach the standard number of times, continuing to send the heartbeat, and entering the step 3 or re-executing the step 4 according to whether the return is made; if the standard times are reached, disconnecting the connection;
and 5, resetting the stable heartbeat count after disconnection, and returning to the step 1 after the current heartbeat value is reduced.
2. A method for adjusting a heartbeat interval based on a long connection of a TCP protocol according to claim 1, wherein said step 1 is preceded by:
setting an initial most careful hop value, an initial maximum hop value, a current heart hop value, a current most careful hop value and a current maximum heart hop value, wherein the current heart hop value takes a value between the initial most careful hop value and the initial maximum heart hop value, and a TCP (transmission control protocol) long connection is established between a client and a server.
3. The method for adjusting heartbeat interval based on long connection of TCP protocol according to claim 2, characterized in that said step 2 includes:
and in the time of one heartbeat clock, if a request of the server is received, returning to the step 1.
4. The method according to claim 3, wherein the step of adjusting the current heartbeat value comprises:
determining whether to adjust the current heartbeat value according to the numerical relationship between the current heartbeat value and the current maximum heartbeat value;
if the current heartbeat value is adjusted, the current heartbeat value is calculated by adopting the following formula:
currentMinH=curentH,
curentH=(currentMinH+currentMaxH)/2;
where currenth represents the current heartbeat value, currentMinH represents the current most careful heartbeat value, and currentMaxH represents the current maximum heartbeat value.
5. The method according to claim 4, wherein the adjusting the current heartbeat value downward includes:
the current heartbeat value is calculated using the following formula:
currentMaxH=curentH,
curentH=(currentMinH+currentMaxH)/2。
6. a heartbeat interval adjusting device based on long connection of a TCP (Transmission control protocol), comprising: set up unit, heartbeat sending unit, heartbeat up-regulation unit, disconnect unit and heartbeat down-regulation unit, wherein:
the setting unit is used for setting a heartbeat clock according to the current heartbeat value and timing;
the heartbeat sending unit is used for sending a heartbeat to the server and judging whether a return of the server is received or not when the time of the heartbeat clock is over if the request of the server is not received within the time of one heartbeat clock;
the heartbeat up-regulation unit is used for increasing a stable heartbeat count by a fixed value if a return of the server is received, judging whether the stable heartbeat count reaches a preset threshold value, and if not, setting the unit to start running; if the current heartbeat value is reached, resetting the stable heartbeat count, and setting the unit to start running after the current heartbeat value is adjusted upwards;
the connection disconnection unit is used for judging the number of times of sending heartbeats to the server if the return of the server is not received, continuing sending heartbeats if the number of times of sending heartbeats does not reach the standard number of times, and starting to run the heartbeat up-regulation unit or running the connection disconnection unit again according to whether the return is made or not; if the standard times are reached, disconnecting the connection;
and the heartbeat down-regulation unit is used for stabilizing the heartbeat count and clearing after disconnection, and the setting unit starts to operate after the current heartbeat value is down-regulated.
7. The apparatus according to claim 6, wherein the setting unit is configured to set an initial maximum heartbeat value, a current maximum heartbeat value, and a current maximum heartbeat value, where the current heartbeat value takes a value between the initial maximum heartbeat value and the initial maximum heartbeat value, and establish the long TCP protocol connection between the servers.
8. A heartbeat interval adjusting device based on TCP protocol long connection according to claim 7, wherein said heartbeat sending unit is configured to start operation of the setting unit if a request from the server is received within a time of a heartbeat clock.
9. The apparatus according to claim 8, wherein the heartbeat up-regulation unit is configured to determine whether to adjust the current heartbeat value according to a numerical relationship between the current heartbeat value and the current maximum heartbeat value;
if the current heartbeat value is adjusted, the current heartbeat value is calculated by adopting the following formula:
currentMinH=curentH,
curentH=(currentMinH+currentMaxH)/2;
where currenth represents the current heartbeat value, currentMinH represents the current most careful heartbeat value, and currentMaxH represents the current maximum heartbeat value.
10. A heartbeat interval adjusting device based on TCP protocol long connection according to claim 9, wherein said heartbeat down-regulation unit is configured to calculate the current heartbeat value by using the following formula:
currentMaxH=curentH,
curentH=(currentMinH+currentMaxH)/2。
CN202110752857.9A 2021-07-02 2021-07-02 Heartbeat interval adjusting method and device based on TCP (Transmission control protocol) long connection Pending CN113422780A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110752857.9A CN113422780A (en) 2021-07-02 2021-07-02 Heartbeat interval adjusting method and device based on TCP (Transmission control protocol) long connection

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110752857.9A CN113422780A (en) 2021-07-02 2021-07-02 Heartbeat interval adjusting method and device based on TCP (Transmission control protocol) long connection

Publications (1)

Publication Number Publication Date
CN113422780A true CN113422780A (en) 2021-09-21

Family

ID=77720240

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110752857.9A Pending CN113422780A (en) 2021-07-02 2021-07-02 Heartbeat interval adjusting method and device based on TCP (Transmission control protocol) long connection

Country Status (1)

Country Link
CN (1) CN113422780A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114268565A (en) * 2021-12-22 2022-04-01 深圳优美创新科技有限公司 Terminal device, heartbeat packet transmission interval detection method thereof and storage medium
CN115103001A (en) * 2022-05-10 2022-09-23 航天国政信息技术(北京)有限公司 Communication method and device and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015184921A1 (en) * 2014-11-28 2015-12-10 中兴通讯股份有限公司 Heartbeat communication implementation method, registration center, server and client
CN106535309A (en) * 2016-10-28 2017-03-22 珠海市魅族科技有限公司 Method and device for keeping network connection
CN111698098A (en) * 2019-03-15 2020-09-22 北京京东尚科信息技术有限公司 Communication method, apparatus and computer-readable storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015184921A1 (en) * 2014-11-28 2015-12-10 中兴通讯股份有限公司 Heartbeat communication implementation method, registration center, server and client
CN106535309A (en) * 2016-10-28 2017-03-22 珠海市魅族科技有限公司 Method and device for keeping network connection
CN111698098A (en) * 2019-03-15 2020-09-22 北京京东尚科信息技术有限公司 Communication method, apparatus and computer-readable storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114268565A (en) * 2021-12-22 2022-04-01 深圳优美创新科技有限公司 Terminal device, heartbeat packet transmission interval detection method thereof and storage medium
CN115103001A (en) * 2022-05-10 2022-09-23 航天国政信息技术(北京)有限公司 Communication method and device and electronic equipment
CN115103001B (en) * 2022-05-10 2024-03-08 航天国政信息技术(北京)有限公司 Communication method and device and electronic equipment

Similar Documents

Publication Publication Date Title
US7684346B2 (en) Communications control for extending the period over which a terminal is able to have an open connection with a host accessible via a packet data network
CN102223257B (en) Heartbeat interval adjusting method, server, client terminal and communication system
US7394788B2 (en) Method and system for setting TCP proxy to reduce packet loss and transmission delay in wire/wireless integrated IP network
JP3949288B2 (en) Gateway device and wireless terminal device
CN113422780A (en) Heartbeat interval adjusting method and device based on TCP (Transmission control protocol) long connection
US20040081159A1 (en) Method and apparatus for multi-media communication over multiple networks
EP1523836B1 (en) Method and apparatus for selecting a window size for a packet switched connection
CN102651701B (en) Set up the method and apparatus that audio/video communication connects
US8730917B2 (en) Method and system for realizing single radio voice call continuity
JP2006528871A (en) Live Nespin protocol to control device pin load
US8712398B2 (en) Soliciting first party in communication session to maintain call when degradation of connection to second party is anticipated
CN110474975B (en) Heartbeat processing method and device of application program, electronic equipment and storage medium
WO2005117387A1 (en) Providing timer control information for protocol
WO2011035621A1 (en) Method and system for controlling access level
EP2866395A1 (en) Maximum transmission unit negotiation method and data terminal
EP2731307A2 (en) Apparatus and method for controlling device triggering in a mobile communication network
US20120195287A1 (en) Communication method using duplicated acknowledgement
JP2001119434A (en) Network system
CN105207949B (en) A kind of TCP optimization methods and system, SP servers
CN106471847B (en) Method and apparatus for communicating data communication sessions between radio access networks
CN105790903A (en) Terminal and terminal call soft handover method
CN102984785B (en) Data are sent by multiple networks
KR20130004848A (en) System, client device, and method for keep-alive communication
RU2625565C1 (en) Method and device for controlling session communication channel, as well as machine-readable data carrier
CN104836836A (en) Network connection method, network connection device and network connection terminal

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

Application publication date: 20210921

RJ01 Rejection of invention patent application after publication