CN114025416A - Dynamic adjustment method and system for detection interval of mobile terminal and server - Google Patents
Dynamic adjustment method and system for detection interval of mobile terminal and server Download PDFInfo
- Publication number
- CN114025416A CN114025416A CN202111261143.4A CN202111261143A CN114025416A CN 114025416 A CN114025416 A CN 114025416A CN 202111261143 A CN202111261143 A CN 202111261143A CN 114025416 A CN114025416 A CN 114025416A
- Authority
- CN
- China
- Prior art keywords
- detection
- mobile terminal
- state
- heartbeat data
- network
- 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
Links
- 238000001514 detection method Methods 0.000 title claims abstract description 299
- 238000000034 method Methods 0.000 title claims abstract description 54
- 230000008569 process Effects 0.000 claims description 26
- 239000000523 sample Substances 0.000 claims description 19
- 238000012545 processing Methods 0.000 claims description 15
- 238000004891 communication Methods 0.000 claims description 7
- 238000011084 recovery Methods 0.000 claims description 6
- 230000004044 response Effects 0.000 description 4
- 230000008859 change Effects 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 238000005265 energy consumption Methods 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 230000002035 prolonged effect Effects 0.000 description 2
- 238000012360 testing method Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 1
- 230000009191 jumping Effects 0.000 description 1
- 238000005259 measurement Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W52/00—Power management, e.g. TPC [Transmission Power Control], power saving or power classes
- H04W52/02—Power saving arrangements
- H04W52/0209—Power saving arrangements in terminal devices
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W76/00—Connection management
- H04W76/20—Manipulation of established connections
- H04W76/27—Transitions between radio resource control [RRC] states
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D30/00—Reducing energy consumption in communication networks
- Y02D30/70—Reducing energy consumption in communication networks in wireless communication networks
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
The invention provides a dynamic adjustment method and a system for a detection interval of a mobile terminal and a server, which comprises the steps that after the mobile terminal is determined to be in a detection state, the mobile terminal runs an application program to detect, a heartbeat data packet is sent to the server on the basis of the initial detection interval duration, if the detection is successful, the first detection duration is increased on the basis of the duration of each detection interval, if the detection is failed, the detection duration is not increased, the current detection interval duration is continuously used for sending the heartbeat data packet, if the detection is failed continuously for a preset number of times, the detection interval is considered to reach the overtime upper limit of the current network, the mobile terminal is switched into a stable state, and the detection interval duration successfully detected last time is used as the detection interval duration of the stable state. The system is applied to the method to realize dynamic adjustment. The invention can dynamically adjust the detection interval duration and reduce the sending times of the heartbeat data packet, thereby improving the resource utilization rate and improving the user experience.
Description
Technical Field
The invention relates to the technical field of internet communication, in particular to a dynamic adjustment method for a detection interval of a mobile terminal and a server and a system applying the method.
Background
With the rapid development of mobile communication networks and the popularization of mobile terminals such as smart phones, APPs are becoming more and more diversified. Many applications of real-time messages require real-time reception of push information from a server, and to achieve this, a long connection is typically used between the terminal and the server for communication.
Because the mobile network has the problems of NAT timeout and DHCP lease timeout, and particularly for the mobile network may have poor signals and instability, the long connection maintained between the mobile terminal and the server is not always valid, and in order to enable the mobile terminal to find that the connection has failed as early as possible, a heartbeat packet sending mechanism is usually adopted between the mobile terminal and the server for detecting to determine whether the connection is still in an available state.
When the mobile terminal and the server are communicated, the mobile terminal sends heartbeat data packets to the server, the server sends responses to the terminal, if the mobile terminal receives the responses, the connection is effective, and if the terminal receives the responses, the response is overtime, the connection is invalid, the terminal can disconnect the current connection and reestablish a new connection.
The prior art detection method mostly adopts a mode of sending heartbeat data packets at fixed time, namely, setting a fixed time interval (such as 3 minutes) to send the heartbeat data packets. In different network environments, the timeout duration is not fixed, and may be much longer than 3 minutes (e.g. 5 minutes), and this method causes unnecessary loss to the traffic and power of the mobile terminal due to the fixed detection interval, and the user experience effect is poor.
Disclosure of Invention
The invention mainly aims to provide a method for dynamically adjusting the detection interval of a mobile terminal and a server, which can dynamically adjust the detection interval duration so as to reduce the sending times of heartbeat data packets.
Another object of the present invention is to provide a system for dynamically adjusting the probing interval of a mobile terminal and a server, which can dynamically adjust the duration of the probing interval, thereby reducing the number of times of sending heartbeat data packets.
In order to achieve the main purpose, the dynamic adjustment method for the detection interval of the mobile terminal and the server provided by the invention comprises the steps that after the mobile terminal is determined to be in a detection state, the mobile terminal runs an application program to detect, a heartbeat data packet is sent to the server on the basis of the initial detection interval duration, and if the detection is successful, a first detection duration is increased on the basis of each detection interval duration; if the detection fails, the detection time length is not increased, the heartbeat data packet is continuously sent by using the current detection interval time length, if the detection fails continuously for a preset number of times, the detection interval is considered to reach the overtime upper limit of the current network, the mobile terminal is switched to a stable state, and the detection interval time length of the last detection success is used as the detection interval time length of the stable state.
In a further scheme, when the mobile terminal runs the application program, reading detection information of a corresponding last detection result according to a current network identifier, wherein the information comprises a state and a detection interval of the current mobile terminal.
In a further scheme, the mobile terminal is switched among an idle state, a detection state and a stable state in an operation period, and if the current state is in the idle state, the mobile terminal waits for network recovery; if the current state is in the detection state, sending a heartbeat data packet to the server, and continuously adjusting the detection interval duration; and if the current state is in a stable state, detecting and solidifying the heartbeat data packet with the optimal detection interval duration, and subsequently continuously sending the heartbeat data packet by using the detection interval.
In a further scheme, when the mobile terminal operates in a detection state, the heartbeat data packet is sent according to the current detection interval duration, when the heartbeat data packet is sent successfully, the first detection duration is increased on the basis of the current detection interval duration, and the next heartbeat data packet sending process is started; if the detection fails, the specific processing comprises: if the detection failure times are less than the preset times, the detection interval duration is not increased, and the next heartbeat data packet sending process is started; if the detection failure times are larger than or equal to the preset times, the current detection interval is considered to reach the maximum overtime length of the network, at the moment, the mobile terminal is switched into a stable state, and the detection interval length of the last detection success is used as the detection interval length of the stable state.
In a further scheme, when the mobile terminal operates in a stable state, the heartbeat data packet is sent according to the detection interval duration of the stable state, when the heartbeat data packet is sent successfully, the preset stable state duration is waited, and then the next heartbeat data packet sending process is started; if the detection fails, the specific processing comprises: if the detection failure times are less than the preset times, directly starting the next heartbeat data packet sending process; if the detection failure times are larger than or equal to the preset times, the network environment where the mobile terminal is located is considered to be changed, the detection interval time recorded in the last stable state is not used any more, and the mobile terminal is switched to the detection state to detect the maximum available detection interval time again.
In a further aspect, in the running process of the application of the mobile terminal, when the network environment is switched, the identifier of the current network is read, and the corresponding network detection result information is read according to the network identifier, and the specific processing includes: if the corresponding network detection result information is not read, directly converting to a detection state; and if the corresponding network detection result information exists, switching to an idle state, a detection state and a stable state according to the state of the network detection result information, and switching among the idle state, the detection state and the stable state in the application running period of the mobile terminal.
In a further scheme, each network is separately distinguished and detected, and the network identification of each network is obtained through an API provided by an operating system.
In order to achieve the above another object, the present invention provides a system for dynamically adjusting a probe interval of a mobile terminal and a server, including: the client of the mobile terminal establishes communication connection with the server through a network in a long connection mode, the mobile terminal sends heartbeat data packets to the server, and the server analyzes the network identification of the mobile terminal and the information of each application program from the uniform heartbeat data packets after receiving the uniform heartbeat data packets; when the mobile terminal is in a detection state, the mobile terminal runs an application program to detect, a heartbeat data packet is sent to the server on the basis of the initial detection interval duration, and if the detection is successful, a first detection duration is increased on the basis of each detection interval duration; if the detection fails, the detection time length is not increased, the heartbeat data packet is continuously sent by using the current detection interval time length, if the detection fails continuously for a preset number of times, the detection interval is considered to reach the overtime upper limit of the current network, the mobile terminal is switched to a stable state, and the detection interval time length of the last detection success is used as the detection interval time length of the stable state.
After determining an application program state table corresponding to the analyzed identifier of the mobile terminal, updating the state of each application program in the application program state table according to the analyzed information of each application program; and for each application program with an online state in the application program state table, sending heartbeat information of the application program according to the heartbeat period of the application program.
In a further scheme, the mobile terminal is switched among an idle state, a detection state and a stable state in an operation period, and if the current state is in the idle state, the mobile terminal waits for network recovery; if the current state is in the detection state, sending a heartbeat data packet to the server, and continuously adjusting the detection interval duration; and if the current state is in a stable state, detecting and solidifying the heartbeat data packet with the optimal detection interval duration, and subsequently continuously sending the heartbeat data packet by using the detection interval.
Therefore, the invention realizes the adjustment of the detection interval according to the requirement, reduces the sending of heartbeat data packets, and has the following beneficial effects:
1. the method can adapt to mobile network environments of different operators and different regions.
2. The service life of the mobile terminal battery can be prolonged, so that the resource utilization rate can be improved, and the user experience can be improved.
3. The method avoids frequent calling of the terminal, and can reduce the network flow usage of the mobile terminal, thereby saving wireless channel resources and reducing the energy consumption of the mobile terminal.
4. The interaction times between the central server and the terminal are greatly reduced, and the processing pressure and the burden of the central server are reduced.
Drawings
Fig. 1 is a flowchart of a method for dynamically adjusting a probe gap between a mobile terminal and a server according to an embodiment of the present invention.
Fig. 2 is a flowchart of various state switching applied to a mobile terminal in an embodiment of a method for dynamically adjusting a probe interval between a mobile terminal and a server according to the present invention.
Fig. 3 is a flowchart of a method for dynamically adjusting a probe interval of a mobile terminal and a server according to an embodiment of the present invention.
Fig. 4 is a flowchart of a method for dynamically adjusting a probe interval between a mobile terminal and a server according to an embodiment of the present invention.
Fig. 5 is a flowchart of a method for dynamically adjusting a probe interval between a mobile terminal and a server according to an embodiment of the present invention, where a network change causes a state switch.
The invention is further explained with reference to the drawings and the embodiments.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the drawings of the embodiments of the present invention. It is to be understood that the embodiments described are only a few embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the described embodiments of the invention without any inventive step, are within the scope of protection of the invention.
An embodiment of a method for dynamically adjusting a detection interval of a mobile terminal and a server comprises the following steps:
referring to fig. 1, the method for dynamically adjusting the detection interval of the mobile terminal and the server according to the present invention includes the following steps:
step S1, after the mobile terminal is determined to be in the detection state, the mobile terminal runs the application program to detect, on the basis of the initial detection interval duration, the heartbeat data packet is sent to the server, and if the detection is successful, the first detection duration is increased on the basis of each detection interval duration;
and step S2, if the detection fails, the detection time length is not increased, and the heartbeat data packet is sent continuously by using the current detection interval time length.
Step S3, if the continuous detection fails for the preset number of times, the mobile terminal determines that the detection interval has reached the timeout upper limit of the current network, and switches to the stable state, and uses the detection interval duration of the last detection success as the detection interval duration of the stable state.
In this embodiment, the mobile terminal application is in a detection state when it is just running, and at this time, the heartbeat data packet is sent from the initial detection interval duration (e.g. 3 minutes), and the detection interval duration is increased by 15 seconds after each success. And if the detection fails, the interval duration is not increased, the heartbeat data packet is continuously sent by using the current detection interval duration, after the continuous detection fails for 5 times, the current network timeout upper limit is considered to be reached, the state is switched to a stable state, and the detection interval duration successfully detected last time is used as the detection interval duration of the stable state.
When the application of the mobile terminal runs in a stable state, if the heartbeat data packet is continuously sent for 5 times, the mobile terminal enters a detection state again.
In this embodiment, when the mobile terminal runs the application program, the detection information of the corresponding last detection result is read according to the current network identifier, where the information includes the state and the detection interval where the current mobile terminal is detected.
The mobile terminal switches among an idle state, a detection state and a stable state in an operation period, and waits for network recovery if the current state is in the idle state; if the current state is in the detection state, sending a heartbeat data packet to the server, and continuously adjusting the detection interval duration; and if the current state is in a stable state, detecting and solidifying the heartbeat data packet with the optimal detection interval duration, and subsequently continuously sending the heartbeat data packet by using the detection interval.
When the mobile terminal operates in a detection state, the heartbeat data packet is sent according to the current detection interval duration, when the heartbeat data packet is sent successfully, the first detection duration is increased on the basis of the current detection interval duration, and the next heartbeat data packet sending process is started.
If the detection fails, the specific processing comprises:
if the detection failure times are less than the preset times, the detection interval duration is not increased, and the next heartbeat data packet sending process is started; if the detection failure times are larger than or equal to the preset times, the current detection interval is considered to reach the maximum overtime length of the network, at the moment, the mobile terminal is switched into a stable state, and the detection interval length of the last detection success is used as the detection interval length of the stable state.
When the mobile terminal operates in a stable state, the heartbeat data packet is sent according to the detection interval duration of the stable state, when the heartbeat data packet is sent successfully, the preset stable state duration is waited, and then the next heartbeat data packet sending process is started.
If the detection fails, the specific processing comprises:
if the detection failure times are less than the preset times, directly starting the next heartbeat data packet sending process; if the detection failure times are larger than or equal to the preset times, the network environment where the mobile terminal is located is considered to be changed, the detection interval time recorded in the last stable state is not used any more, and the mobile terminal is switched to the detection state to detect the maximum available detection interval time again.
In the running process of the application of the mobile terminal, when the network environment is switched, the identification of the current network is read, and the corresponding network detection result information is read according to the network identification, wherein the specific processing comprises the following steps: if the corresponding network detection result information is not read, directly converting to a detection state; and if the corresponding network detection result information exists, switching to an idle state, a detection state and a stable state according to the state of the network detection result information, and switching among the idle state, the detection state and the stable state in the application running period of the mobile terminal.
In this embodiment, probes are distinguished for each network individually, and the network identifier of each network is obtained through an API provided by the operating system. Specifically, since the timeout duration of each network may be inconsistent, each network needs to be separately detected, common mobile network environments include 2G, 3G, 4G, and 5G networks of china mobile, china unicom, and china telecom, each network has its own unique identifier, the application can be obtained through an API provided by an operating system, and wireless communication networks such as WIFI are used as network identifiers (e.g., WIFI) according to their names.
Specifically, the present invention sets the states of the mobile terminal applications to 3, as follows:
detecting state: in a state of continuously adjusting the detection interval.
And (3) steady state: and selecting an optimal detection interval, solidifying, and then continuously using the interval to send heartbeat data packets.
An idle state: the state when the network is unavailable, no probing is performed at this time, and no probing hop packet is sent.
Wherein the mobile terminal application is constantly switched between 3 states within the operation period.
In practical application, the invention firstly sets relevant variables as follows:
minHeartbeat is a minimum detection interval duration (initial detection interval duration) of 3 minutes;
maxHeartbeat: the maximum detection interval duration is 10 minutes;
stableHeartbeat: a detection interval duration of a steady state;
prevHeartbeat: the interval duration of the last successful detection;
currHeartbeat: the interval duration currently being probed.
As shown in fig. 2, when the mobile terminal application is started, the detection information of the corresponding last detection result is read according to the current network identifier, including the state where the detection is located, the detection interval, and the like. If the current state is in the detection process of switching to the detection state, if the current state is in the detection process of switching to the stable state, and if the current state is in the idle state, waiting for the network to recover.
As shown in fig. 3, when the mobile terminal application is in the detection state, the heartbeat packet is sent according to the currHeartbeat interval, when the sending is successful, the currHeartbeat interval is increased by 15 seconds, and then the next heartbeat packet sending flow is started; if the detection fails, the detection is processed in two cases:
1) and if the detection failure times are less than 5, not increasing the interval duration, and then starting the next heartbeat data packet sending process.
2) If the detection failure times are more than or equal to 5 times, the maximum overtime time of the network is considered to be reached currently, the network is switched into a stable state, and the time length of the last detection success is used as the detection interval time length (stepablehertpeak) of the stable state.
In practical tests, as long as the detection interval duration exceeds the maximum timeout duration of the network, detection can not be successfully performed at one time basically. However, in some special cases, even if the timeout period is not reached, a failure is detected, for example, an environment where the network suddenly deteriorates such as an elevator is entered, so that the upper failure limit is set to 5 times in order to reduce similar errors, which means that a plurality of trials are performed, and this is an empirical value for integrating the actual measurement effect.
As shown in fig. 4, when the application of the mobile terminal is in a stable state, the heartbeat data packet is sent according to the steableHeartbeat interval, when the sending is successful, the heartbeat data packet is waited for the duration of the steableHeartbeat interval, and then the next heartbeat data packet sending process is started; if the detection fails, the detection is processed in two cases:
1) if the detection failure times are less than 5, directly starting the next heartbeat data packet sending process;
2) if the detection failure times are more than or equal to 5, the network environment where the current network environment is located is considered to be changed, the interval duration recorded in the last stable state is possibly not applicable any more, and then the network environment is switched into the detection state, and the maximum available interval duration is detected again.
Similarly, the upper limit of the number of failures is set to 5, mainly to eliminate errors. In practical tests, detection can be recovered basically within 3 times under the condition of excluding the change of the network environment, and if continuous detection fails for 5 times, the network environment can be determined to have changed at the moment and needs to be detected again.
As shown in fig. 5, when the mobile terminal is in an operating process, a network change may cause a state switch, and no matter what detection state the mobile terminal is in, when the network is switched, the currently operating detection may be interrupted to perform the state switch. When the network is switched, firstly reading the identifier of the current network, then reading the corresponding network detection result information according to the network identifier, and processing according to the following conditions:
1) and if the corresponding network detection result information is not read, directly converting to a detection state.
2) And if the corresponding network detection result information exists, jumping to an idle state, a detection state or a stable state according to the state of the information.
Therefore, the invention realizes the adjustment of the detection interval according to the requirement, reduces the sending of heartbeat data packets, and has the following beneficial effects:
1. the method can adapt to mobile network environments of different operators and different regions.
2. The service life of the mobile terminal battery can be prolonged, so that the resource utilization rate can be improved, and the user experience can be improved.
3. The method avoids frequent calling of the terminal, and can reduce the network flow usage of the mobile terminal, thereby saving wireless channel resources and reducing the energy consumption of the mobile terminal.
4. The interaction times between the central server and the terminal are greatly reduced, and the processing pressure and the burden of the central server are reduced.
An embodiment of a system for dynamically adjusting a detection interval of a mobile terminal and a server is disclosed:
the invention provides a dynamic adjustment system for detection intervals of a mobile terminal and a server, which comprises:
the client of the mobile terminal establishes communication connection with the server through a network in a long connection mode, the mobile terminal sends heartbeat data packets to the server, and the server analyzes the network identification of the mobile terminal and the information of each application program from the uniform heartbeat data packets after receiving the uniform heartbeat data packets.
When the mobile terminal is in a detection state, the mobile terminal runs an application program to detect, on the basis of the initial detection interval duration, the heartbeat data packet is sent to the server, and if the detection is successful, the first detection duration is increased on the basis of the detection interval duration every time.
And if the detection fails, the detection time length is not increased, and the heartbeat data packet is continuously sent by using the current detection interval time length.
And if the continuous detection fails for the preset times, the mobile terminal determines that the detection interval reaches the overtime upper limit of the current network, and switches the mobile terminal to a stable state, and uses the detection interval duration of the last detection success as the detection interval duration of the stable state.
After determining the application program state table corresponding to the analyzed identifier of the mobile terminal, updating the state of each application program in the application program state table according to the analyzed information of each application program; and for each application program with an online state in the application program state table, sending heartbeat information of the application program according to the heartbeat period of the application program.
Specifically, for each mobile terminal, there is an application program state table corresponding to the identifier of the mobile terminal, and there may also be a heartbeat information cache table and an application program basic information table corresponding to the identifier of the mobile terminal.
If the server analyzes the heartbeat information of the application program from the uniform heartbeat data packet sent by the mobile terminal, recording the address information in the analyzed heartbeat information of the application program, which corresponds to the serial number of the application program, into a heartbeat information cache table corresponding to the analyzed identifier of the mobile terminal; recording the heartbeat period in the analyzed heartbeat information of the application program, and the number corresponding to the application program into an application program basic information table corresponding to the analyzed identifier of the mobile terminal; and updating the time of the serial number record corresponding to the application program in the application program state table corresponding to the analyzed identifier of the mobile terminal by using the heartbeat time in the heartbeat information of the analyzed application program, and recording the state of the application program to be online corresponding to the serial number of the application program. The address information is specifically a terminal address and a server address.
In this embodiment, when the mobile terminal runs the application program, the detection information of the corresponding last detection result is read according to the current network identifier, where the information includes the state and the detection interval where the current mobile terminal is detected.
The mobile terminal switches among an idle state, a detection state and a stable state in an operation period, and waits for network recovery if the current state is in the idle state; if the current state is in the detection state, sending a heartbeat data packet to the server, and continuously adjusting the detection interval duration; and if the current state is in a stable state, detecting and solidifying the heartbeat data packet with the optimal detection interval duration, and subsequently continuously sending the heartbeat data packet by using the detection interval.
When the mobile terminal operates in a detection state, the heartbeat data packet is sent according to the current detection interval duration, when the heartbeat data packet is sent successfully, the first detection duration is increased on the basis of the current detection interval duration, and the next heartbeat data packet sending process is started.
If the detection fails, the specific processing comprises:
if the detection failure times are less than the preset times, the detection interval duration is not increased, and the next heartbeat data packet sending process is started; if the detection failure times are larger than or equal to the preset times, the current detection interval is considered to reach the maximum overtime length of the network, at the moment, the mobile terminal is switched into a stable state, and the detection interval length of the last detection success is used as the detection interval length of the stable state.
When the mobile terminal operates in a stable state, the heartbeat data packet is sent according to the detection interval duration of the stable state, when the heartbeat data packet is sent successfully, the preset stable state duration is waited, and then the next heartbeat data packet sending process is started.
If the detection fails, the specific processing comprises:
if the detection failure times are less than the preset times, directly starting the next heartbeat data packet sending process; if the detection failure times are larger than or equal to the preset times, the network environment where the mobile terminal is located is considered to be changed, the detection interval time recorded in the last stable state is not used any more, and the mobile terminal is switched to the detection state to detect the maximum available detection interval time again.
In the running process of the application of the mobile terminal, when the network environment is switched, the identification of the current network is read, and the corresponding network detection result information is read according to the network identification, wherein the specific processing comprises the following steps: if the corresponding network detection result information is not read, directly converting to a detection state; and if the corresponding network detection result information exists, switching to an idle state, a detection state and a stable state according to the state of the network detection result information, and switching among the idle state, the detection state and the stable state in the application running period of the mobile terminal.
In this embodiment, probes are distinguished for each network individually, and the network identifier of each network is obtained through an API provided by the operating system. Specifically, since the timeout duration of each network may be inconsistent, each network needs to be separately detected, common mobile network environments include 2G, 3G, 4G, and 5G networks of china mobile, china unicom, and china telecom, each network has its own unique identifier, the application can be obtained through an API provided by an operating system, and wireless communication networks such as WIFI are used as network identifiers (e.g., WIFI) according to their names.
It should be noted that the above is only a preferred embodiment of the present invention, but the design concept of the present invention is not limited thereto, and any insubstantial modifications made by using the design concept also fall within the protection scope of the present invention.
Claims (10)
1. A method for dynamically adjusting a detection interval between a mobile terminal and a server is characterized by comprising the following steps:
after the mobile terminal is determined to be in a detection state, the mobile terminal runs an application program to detect, a heartbeat data packet is sent to a server on the basis of the initial detection interval duration, and if the detection is successful, a first detection duration is increased on the basis of each detection interval duration;
if the detection fails, the detection time length is not increased, the heartbeat data packet is continuously sent by using the current detection interval time length, if the detection fails continuously for a preset number of times, the detection interval is considered to reach the overtime upper limit of the current network, the mobile terminal is switched to a stable state, and the detection interval time length of the last detection success is used as the detection interval time length of the stable state.
2. The method for dynamically adjusting the probe interval between a mobile terminal and a server according to claim 1, wherein:
and when the mobile terminal runs the application program, reading detection information of the corresponding last detection result according to the current network identification, wherein the information comprises the state and the detection interval of the current mobile terminal.
3. The method for dynamically adjusting the probe interval between the mobile terminal and the server according to claim 2, wherein:
switching among an idle state, a detection state and a stable state in the operation period of the mobile terminal, and waiting for network recovery if the current state is in the idle state; if the current state is in the detection state, sending a heartbeat data packet to the server, and continuously adjusting the detection interval duration; and if the current state is in a stable state, detecting and solidifying the heartbeat data packet with the optimal detection interval duration, and subsequently continuously sending the heartbeat data packet by using the detection interval.
4. The method for dynamically adjusting the probe interval between the mobile terminal and the server according to claim 3, wherein:
when the mobile terminal operates in a detection state, sending a heartbeat data packet according to the current detection interval duration, when the mobile terminal is successfully sent, increasing a first detection duration on the basis of the current detection interval duration, and starting a next heartbeat data packet sending process;
if the detection fails, the specific processing comprises:
if the detection failure times are less than the preset times, the detection interval duration is not increased, and the next heartbeat data packet sending process is started;
if the detection failure times are larger than or equal to the preset times, the current detection interval is considered to reach the maximum overtime length of the network, at the moment, the mobile terminal is switched into a stable state, and the detection interval length of the last detection success is used as the detection interval length of the stable state.
5. The method for dynamically adjusting the probe interval between the mobile terminal and the server according to claim 3, wherein:
when the mobile terminal operates in a stable state, sending heartbeat data packets according to the detection interval duration of the stable state, and when the heartbeat data packets are sent successfully, waiting for the preset stable state duration, and then starting the next heartbeat data packet sending process;
if the detection fails, the specific processing comprises:
if the detection failure times are less than the preset times, directly starting the next heartbeat data packet sending process;
if the detection failure times are larger than or equal to the preset times, the network environment where the mobile terminal is located is considered to be changed, the detection interval time recorded in the last stable state is not used any more, and the mobile terminal is switched to the detection state to detect the maximum available detection interval time again.
6. The method for dynamically adjusting the probe interval between the mobile terminal and the server according to any one of claims 1 to 5, wherein:
in the running process of the application of the mobile terminal, when the network environment is switched, the identification of the current network is read, and the corresponding network detection result information is read according to the network identification, wherein the specific processing comprises the following steps:
if the corresponding network detection result information is not read, directly converting to a detection state;
and if the corresponding network detection result information exists, switching to an idle state, a detection state and a stable state according to the state of the network detection result information, and switching among the idle state, the detection state and the stable state in the application running period of the mobile terminal.
7. The method for dynamically adjusting the probe interval between the mobile terminal and the server according to any one of claims 1 to 5, wherein:
and (3) distinguishing the probes for each network independently, and obtaining the network identification of each network through an API (application program interface) provided by an operating system.
8. A system for dynamically adjusting a probe interval of a mobile terminal and a server, the system being applied to the method for dynamically adjusting a probe interval of a mobile terminal and a server according to any one of claims 1 to 7, the system comprising:
the client of the mobile terminal establishes communication connection with the server through a network in a long connection mode, the mobile terminal sends heartbeat data packets to the server, and the server analyzes the network identification of the mobile terminal and the information of each application program from the uniform heartbeat data packets after receiving the uniform heartbeat data packets;
when the mobile terminal is in a detection state, the mobile terminal runs an application program to detect, a heartbeat data packet is sent to the server on the basis of the initial detection interval duration, and if the detection is successful, a first detection duration is increased on the basis of each detection interval duration;
if the detection fails, the detection time length is not increased, the heartbeat data packet is continuously sent by using the current detection interval time length, if the detection fails continuously for a preset number of times, the detection interval is considered to reach the overtime upper limit of the current network, the mobile terminal is switched to a stable state, and the detection interval time length of the last detection success is used as the detection interval time length of the stable state.
9. The system for dynamically adjusting the probe interval between a mobile terminal and a server according to claim 8, wherein:
after determining the application program state table corresponding to the analyzed identifier of the mobile terminal, updating the state of each application program in the application program state table according to the analyzed information of each application program; and for each application program with an online state in the application program state table, sending heartbeat information of the application program according to the heartbeat period of the application program.
10. The system for dynamically adjusting the probe interval between a mobile terminal and a server according to claim 8 or 9, wherein:
switching among an idle state, a detection state and a stable state in the operation period of the mobile terminal, and waiting for network recovery if the current state is in the idle state; if the current state is in the detection state, sending a heartbeat data packet to the server, and continuously adjusting the detection interval duration; and if the current state is in a stable state, detecting and solidifying the heartbeat data packet with the optimal detection interval duration, and subsequently continuously sending the heartbeat data packet by using the detection interval.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111261143.4A CN114025416A (en) | 2021-10-28 | 2021-10-28 | Dynamic adjustment method and system for detection interval of mobile terminal and server |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111261143.4A CN114025416A (en) | 2021-10-28 | 2021-10-28 | Dynamic adjustment method and system for detection interval of mobile terminal and server |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114025416A true CN114025416A (en) | 2022-02-08 |
Family
ID=80058043
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111261143.4A Pending CN114025416A (en) | 2021-10-28 | 2021-10-28 | Dynamic adjustment method and system for detection interval of mobile terminal and server |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114025416A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114390453A (en) * | 2022-02-09 | 2022-04-22 | 福建天泉教育科技有限公司 | Message pushing optimization method and terminal |
CN116016276A (en) * | 2022-12-02 | 2023-04-25 | 京东科技信息技术有限公司 | Method and device for detecting health state of server |
CN117294750A (en) * | 2023-11-27 | 2023-12-26 | 杭州涂鸦信息技术有限公司 | Method and device for adjusting MQTT heartbeat frequency |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103209089A (en) * | 2012-01-17 | 2013-07-17 | 华为技术有限公司 | Method for obtaining heart beat period, terminal and server |
US20130185421A1 (en) * | 2012-01-17 | 2013-07-18 | Huawei Technologies Co., Ltd. | Method, Terminal, and Server for Obtaining Heartbeat Period |
CN103856954A (en) * | 2012-11-28 | 2014-06-11 | 中国电信股份有限公司 | Method and system for detecting roam terminal heartbeat cycle, roam terminal and server |
CN111641703A (en) * | 2020-05-27 | 2020-09-08 | 广东小天才科技有限公司 | Method for determining TCP heartbeat period of terminal equipment, terminal equipment and server |
-
2021
- 2021-10-28 CN CN202111261143.4A patent/CN114025416A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103209089A (en) * | 2012-01-17 | 2013-07-17 | 华为技术有限公司 | Method for obtaining heart beat period, terminal and server |
US20130185421A1 (en) * | 2012-01-17 | 2013-07-18 | Huawei Technologies Co., Ltd. | Method, Terminal, and Server for Obtaining Heartbeat Period |
CN103856954A (en) * | 2012-11-28 | 2014-06-11 | 中国电信股份有限公司 | Method and system for detecting roam terminal heartbeat cycle, roam terminal and server |
CN111641703A (en) * | 2020-05-27 | 2020-09-08 | 广东小天才科技有限公司 | Method for determining TCP heartbeat period of terminal equipment, terminal equipment and server |
Cited By (5)
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 |
CN116016276A (en) * | 2022-12-02 | 2023-04-25 | 京东科技信息技术有限公司 | Method and device for detecting health state of server |
CN117294750A (en) * | 2023-11-27 | 2023-12-26 | 杭州涂鸦信息技术有限公司 | Method and device for adjusting MQTT heartbeat frequency |
CN117294750B (en) * | 2023-11-27 | 2024-03-01 | 杭州涂鸦信息技术有限公司 | Method and device for adjusting MQTT heartbeat frequency |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN114025416A (en) | Dynamic adjustment method and system for detection interval of mobile terminal and server | |
CN107645529B (en) | Heartbeat packet sending method and device | |
KR100807654B1 (en) | Method, and associated apparatus, for transitioning communications of hybrid access terminal between communication systems | |
US7373145B2 (en) | Contact management for mobile communications devices in wireless packet switched networks | |
EP2596673B1 (en) | User device dormancy | |
CN101754295B (en) | Method, system and terminal for monitoring paging indicator and paging channel | |
JP2011510557A (en) | Method and arrangement for processing a wireless receiver in a wireless communication network | |
US20150146593A1 (en) | User device dormancy | |
CN109040295B (en) | Method and device for determining abnormal disconnection, terminal and storage medium | |
CN102647307A (en) | Method and system for reducing heartbeat messages | |
CN113727403B (en) | Network switching method, device, electronic equipment and readable storage medium | |
CN110740491B (en) | Communication processing method and device of wireless network and household appliance | |
CN117336895A (en) | Information sending method and system for user equipment de-registration | |
CN102711254B (en) | Resource release control method of network side and radio network controller (RNC) | |
CN115190556B (en) | Communication method, source base station, target base station, communication system, and storage medium | |
CN103327482A (en) | Terminal and network switching control method | |
JP4697594B2 (en) | PDP context control system, method, program, and portable terminal | |
WO2006069531A1 (en) | A method that user terminal accesses core network via wireless access network | |
CN108322387B (en) | Network connection method and device of gateway | |
CN114374423B (en) | Autonomous detection method for abnormal network disconnection of satellite mobile communication service | |
JP2014135705A (en) | Base station device, gateway device, communication system and communication method | |
KR100898939B1 (en) | Apparatus, and associated method, for permitting communication system transition based upon signal threshold determination | |
CN115515200A (en) | Data cut-off recovery method, terminal and storage medium | |
CN113596837A (en) | Method and system for determining core network selection | |
CN116546580A (en) | Network switching method, device, client terminal equipment, storage medium and product |
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 |