[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN108430116B - Disconnected network reconnection method, medium, device and computing equipment - Google Patents

Disconnected network reconnection method, medium, device and computing equipment Download PDF

Info

Publication number
CN108430116B
CN108430116B CN201810174494.3A CN201810174494A CN108430116B CN 108430116 B CN108430116 B CN 108430116B CN 201810174494 A CN201810174494 A CN 201810174494A CN 108430116 B CN108430116 B CN 108430116B
Authority
CN
China
Prior art keywords
target application
application program
network
server
reconnection
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810174494.3A
Other languages
Chinese (zh)
Other versions
CN108430116A (en
Inventor
黄�俊
周江华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Netease Zhiqi Technology Co Ltd
Original Assignee
Hangzhou Langhe 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 Hangzhou Langhe Technology Co Ltd filed Critical Hangzhou Langhe Technology Co Ltd
Priority to CN201810174494.3A priority Critical patent/CN108430116B/en
Publication of CN108430116A publication Critical patent/CN108430116A/en
Application granted granted Critical
Publication of CN108430116B publication Critical patent/CN108430116B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/19Connection re-establishment
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/04Real-time or near real-time messaging, e.g. instant messaging [IM]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/48Message addressing, e.g. address format or anonymous messages, aliases

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

The embodiment of the invention provides a disconnected network reconnection method, medium, device and computing equipment. The disconnected network reconnection method comprises the following steps: detecting the running state of a target application program in a terminal, wherein the running state comprises whether the target application program runs in a foreground or in a background; and according to the running state of the target application program, reconnecting by using a corresponding reconnecting strategy when the network connection of the target application program is abnormal. According to the technical scheme of the embodiment of the invention, the corresponding reconnection strategy can be adopted to reconnect based on the running state of the application program, the problem that different disconnected network reconnection scenes are difficult to deal with due to the adoption of a fixed disconnected network reconnection strategy is solved, and the reasonability, stability and reliability of disconnected network reconnection are improved.

Description

Disconnected network reconnection method, medium, device and computing equipment
Technical Field
The embodiment of the invention relates to the technical field of communication and computers, in particular to a disconnected network reconnection method, a disconnected network reconnection medium, a disconnected network reconnection device and a computing device.
Background
This section is intended to provide a background or context to the embodiments of the invention that are recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.
For instant messaging software, a very important problem is the disconnection and reconnection, and various disconnection and reconnection mechanisms have been proposed in the related art.
Disclosure of Invention
However, various problems generally exist with current network disconnection and reconnection mechanisms. For example, some network disconnection and reconnection mechanisms only monitor the system network state, and reconnect when the system network state changes, if an application runs in the background for a while, a process is suspended, or is set to be awake aligned, the network connection may fail, but the network of the system is not disconnected in the process, so the network disconnection and reconnection mechanism may cause the application to have no chance to reconnect.
For another example, if the network connection is limited after the application program runs for a period of time in the background, the connection may be failed, but no system callback message is received, and then when the application program switches to the foreground running, the application program cannot sense the connection abnormality, and reconnection is performed until the message is sent and the network timeout abnormality occurs, which results in poor user experience.
Therefore, an improved disconnected network reconnection scheme is highly needed, which can adopt a corresponding reconnection strategy to reconnect based on the running state of an application program, and solve the problem that different disconnected network reconnection scenes are difficult to deal with due to the adoption of a fixed disconnected network reconnection strategy.
In this context, embodiments of the present invention are intended to provide a disconnected network reconnection method, medium, apparatus, and computing device.
In a first aspect of the embodiments of the present invention, there is provided a method for reconnection of a disconnected network, including: detecting the running state of a target application program in a terminal, wherein the running state comprises whether the target application program runs in a foreground or in a background; and according to the running state of the target application program, reconnecting by using a corresponding reconnecting strategy when the network connection of the target application program is abnormal.
In some embodiments of the present invention, based on the foregoing solution, according to the running state of the target application, reconnecting with a corresponding reconnection policy when the network connection of the target application is abnormal, including: when the target application program runs in the foreground, if the situation that the connection between the target application program and the server is disconnected but the local network of the terminal is normal is detected, the target application program is controlled to be immediately reconnected with the server.
In some embodiments of the present invention, based on the foregoing scheme, the method further comprises: and if the target application program fails to be reconnected with the server, replacing the network address of the server to which the target application program needs to be connected so as to control the target application program to be reconnected with other servers.
In some embodiments of the present invention, based on the foregoing solution, replacing the network address of the server to which the target application needs to connect includes: and sequentially selecting network addresses from the available server network address set to replace the network addresses of the servers to which the target application program needs to be connected until the reconnection is successful or the traversal of the network addresses in the server network address set is completed.
In some embodiments of the present invention, based on the foregoing scheme, the method further comprises: and acquiring the server network address set distributed by the appointed equipment according to the position information of the terminal.
In some embodiments of the present invention, based on the foregoing scheme, if traversing the network addresses in the server network address set is completed, the server network address set allocated by the designated device is obtained again.
In some embodiments of the present invention, based on the foregoing solution, according to the running state of the target application, reconnecting with a corresponding reconnection policy when the network connection of the target application is abnormal, including: when the target application program runs in the background, if the fact that the connection between the target application program and the server is disconnected but the local network of the terminal is normal is detected, the target application program is controlled to be reconnected with the server at a preset reconnection interval.
In some embodiments of the present invention, based on the above scheme, the predetermined reconnection interval is positively correlated with the number of reconnections.
In some embodiments of the present invention, based on the foregoing solution, according to the running state of the target application, reconnecting with a corresponding reconnection policy when the network connection of the target application is abnormal, including: and if the network connection is limited when the target application program is switched to the background operation, controlling the target application program to reconnect with the server within first preset time when the target application program is detected to be switched from the background operation to the foreground operation.
In some embodiments of the present invention, based on the foregoing solution, according to the running state of the target application, reconnecting with a corresponding reconnection policy when the network connection of the target application is abnormal, including: if the network connection is not limited when the target application program is switched to the background operation, controlling the target application program to send a heartbeat packet to a server when the target application program is detected to be switched from the background operation to the foreground operation; and if the response message of the server to the heartbeat packet is not received within second preset time, controlling the target application program to disconnect the server and reconnect the target application program.
In some embodiments of the present invention, based on the foregoing solution, the running status further includes whether the target application has established a connection with a server; according to the running state of the target application program, when the network connection of the target application program is abnormal, reconnection is carried out by using a corresponding reconnection strategy, wherein the reconnection strategy comprises the following steps: when the target application program is not connected with the server, if a push process of the target application program receives a communication binding message between processes sent by a User Interface (UI) process, controlling the target application program to be reconnected with the server.
In some embodiments of the present invention, based on the foregoing solution, the running state further includes whether the target application is in a network connection state; according to the running state of the target application program, when the network connection of the target application program is abnormal, reconnection is carried out by using a corresponding reconnection strategy, wherein the reconnection strategy comprises the following steps: when the target application program is switched to the foreground from the background to run and is in the network connection state, if the time length of the target application program in the network connection state reaches a first set time length, the target application program is controlled to be reconnected with the server.
In some embodiments of the present invention, based on the foregoing scheme, the method further comprises: if the local network of the terminal is detected to be in a disconnected state, monitoring a message of network state change; and when the message of the network state change is monitored, controlling the target application program to reconnect with the server.
In some embodiments of the present invention, based on the foregoing scheme, the performing reconnection comprises: starting a counter to count; and if the value of the counter is equal to any value in a preset value set, starting reconnection operation.
In some embodiments of the present invention, based on the foregoing scheme, the starting of the counter for counting includes: if the target application program runs in the foreground and is reconnected for the first time, after a first preset time length, adding 1 to the count of the counter; and if the target application program runs in the background and is reconnected for the first time, adding 1 to the count of the counter after a second preset time period.
In some embodiments of the present invention, based on the above scheme, the second predetermined time period is a random value within a first predetermined interval, and a minimum value within the first predetermined interval is greater than the first predetermined time period.
In some embodiments of the present invention, based on the foregoing scheme, the starting of the counter for counting includes: if the target application program operates in the foreground and is not reconnected for the first time, the counting of the counter is increased by 1 every time a third preset time length passes; and if the target application program runs in the background and is not reconnected for the first time, adding 1 to the count of the counter every time a fourth preset time length passes.
In some embodiments of the present invention, based on the above scheme, the fourth predetermined time period is a random value within a second predetermined interval, and a minimum value within the second predetermined interval is greater than or equal to the third predetermined time period.
In some embodiments of the present invention, based on the foregoing scheme, if the terminal is connected to the first network, the third predetermined time period is a first value; and if the terminal is connected with a second network, the third preset time length is a second value.
In some embodiments of the present invention, based on the foregoing scheme, if the first network is a Wi-Fi network and the second network is a mobile communication network, the second value is greater than the first value.
In some embodiments of the invention, based on the above scheme, the values in the preset set of values are from 0 to N powers of a predetermined value, where N is an integer greater than or equal to 0.
In some embodiments of the invention, the predetermined value is 2 based on the foregoing scheme.
In some embodiments of the present invention, based on the foregoing solution, detecting an operating state of a target application in a terminal includes: and if the onActivityResummed method call-back is detected and the previous state of the target application program is detected to be in background operation, determining that the target application program is switched to the foreground operation.
In some embodiments of the present invention, based on the foregoing solution, detecting an operating state of a target application in a terminal includes: if the onActivityPaused method call back is detected, detecting whether the previous state of the target application program runs in the foreground or not after a second set time length; and if the previous state of the target application program is detected to be running in the foreground, determining that the target application program is switched to be running in the background.
In some embodiments of the present invention, based on the foregoing solution, detecting an operating state of a target application in a terminal includes: and if the onActivityPaused method call-back is detected and the onActivityResummed method call-back is detected within a third set time length or after the third set time length, determining that the target application program runs in the foreground.
In some embodiments of the present invention, based on the foregoing solution, detecting an operating state of a target application in a terminal includes: and calling a system method for judging whether the application program is in foreground operation in the terminal in a reflection mode to determine whether the target application program is in foreground operation.
In a second aspect of embodiments of the present invention, there is provided a medium having a program stored thereon, which when executed by a processor, performs the method as described in the first aspect of the embodiments above.
In a third aspect of embodiments of the present invention, there is provided a disconnected network reconnection device, including: the terminal comprises a detection unit, a processing unit and a processing unit, wherein the detection unit is used for detecting the running state of a target application program in the terminal, and the running state comprises whether the target application program runs in the foreground or in the background; and the reconnection processing unit is used for performing reconnection according to the running state of the target application program by using a corresponding reconnection strategy when the network connection of the target application program is abnormal.
In some embodiments of the present invention, based on the foregoing solution, the reconnection processing unit is configured to: when the target application program runs in the foreground, if the situation that the connection between the target application program and the server is disconnected but the local network of the terminal is normal is detected, the target application program is controlled to be immediately reconnected with the server.
In some embodiments of the present invention, based on the foregoing scheme, the reconnection processing unit is further configured to: and if the target application program fails to be reconnected with the server, replacing the network address of the server to which the target application program needs to be connected so as to control the target application program to be reconnected with other servers.
In some embodiments of the present invention, based on the foregoing solution, the reconnection processing unit is configured to: and sequentially selecting network addresses from the available server network address set to replace the network addresses of the servers to which the target application program needs to be connected until the reconnection is successful or the traversal of the network addresses in the server network address set is completed.
In some embodiments of the present invention, based on the foregoing solution, the apparatus further includes: and the acquisition unit is used for acquiring the server network address set distributed by the appointed equipment according to the position information of the terminal.
In some embodiments of the present invention, based on the foregoing scheme, the obtaining unit is further configured to: and if the network address in the server network address set is traversed, the server network address set distributed by the specified equipment is obtained again.
In some embodiments of the present invention, based on the foregoing solution, the reconnection processing unit is configured to: when the target application program runs in the background, if the fact that the connection between the target application program and the server is disconnected but the local network of the terminal is normal is detected, the target application program is controlled to be reconnected with the server at a preset reconnection interval.
In some embodiments of the present invention, based on the above scheme, the predetermined reconnection interval is positively correlated with the number of reconnections.
In some embodiments of the present invention, based on the foregoing solution, the reconnection processing unit is configured to: and if the network connection is limited when the target application program is switched to the background operation, controlling the target application program to reconnect with the server within first preset time when the target application program is detected to be switched from the background operation to the foreground operation.
In some embodiments of the present invention, based on the foregoing solution, the reconnection processing unit is configured to: if the network connection is not limited when the target application program is switched to the background operation, controlling the target application program to send a heartbeat packet to a server when the target application program is detected to be switched from the background operation to the foreground operation; and if the response message of the server to the heartbeat packet is not received within second preset time, controlling the target application program to disconnect the server and reconnect the target application program.
In some embodiments of the present invention, based on the foregoing solution, the running status further includes whether the target application has established a connection with a server; the reconnect processing unit is configured to: and when the target application program is not connected with the server, if the push process of the target application program receives a communication binding message between processes sent by a UI (user interface) process, controlling the target application program to be reconnected with the server.
In some embodiments of the present invention, based on the foregoing solution, the running state further includes whether the target application is in a network connection state; the reconnect processing unit is configured to: when the target application program is switched to the foreground from the background to run and is in the network connection state, if the time length of the target application program in the network connection state reaches a first set time length, the target application program is controlled to be reconnected with the server.
In some embodiments of the present invention, based on the foregoing scheme, the reconnection processing unit is further configured to: if the local network of the terminal is detected to be in a disconnected state, monitoring a message of network state change; and when the message of the network state change is monitored, controlling the target application program to reconnect with the server.
In some embodiments of the present invention, based on the foregoing solution, the reconnection processing unit includes: the counting unit is used for starting the counter to count; and the execution unit is used for starting reconnection operation when the value of the counter is equal to any value in a preset value set.
In some embodiments of the present invention, based on the foregoing scheme, the counting unit is configured to: if the target application program runs in the foreground and is reconnected for the first time, after a first preset time length, adding 1 to the count of the counter; and if the target application program runs in the background and is reconnected for the first time, adding 1 to the count of the counter after a second preset time period.
In some embodiments of the present invention, based on the above scheme, the second predetermined time period is a random value within a first predetermined interval, and a minimum value within the first predetermined interval is greater than the first predetermined time period.
In some embodiments of the present invention, based on the foregoing scheme, the counting unit is configured to: if the target application program operates in the foreground and is not reconnected for the first time, the counting of the counter is increased by 1 every time a third preset time length passes; and if the target application program runs in the background and is not reconnected for the first time, adding 1 to the count of the counter every time a fourth preset time length passes.
In some embodiments of the present invention, based on the above scheme, the fourth predetermined time period is a random value within a second predetermined interval, and a minimum value within the second predetermined interval is greater than or equal to the third predetermined time period.
In some embodiments of the present invention, based on the foregoing scheme, if the terminal is connected to the first network, the third predetermined time period is a first value; and if the terminal is connected with a second network, the third preset time length is a second value.
In some embodiments of the present invention, based on the foregoing scheme, if the first network is a Wi-Fi network and the second network is a mobile communication network, the second value is greater than the first value.
In some embodiments of the invention, based on the above scheme, the values in the preset set of values are from 0 to N powers of a predetermined value, where N is an integer greater than or equal to 0.
In some embodiments of the invention, the predetermined value is 2 based on the foregoing scheme.
In some embodiments of the present invention, based on the foregoing scheme, the detection unit is configured to: and if the onActivityResummed method call-back is detected and the previous state of the target application program is detected to be in background operation, determining that the target application program is switched to the foreground operation.
In some embodiments of the present invention, based on the foregoing scheme, the detection unit is configured to: if the onActivityPaused method call back is detected, detecting whether the previous state of the target application program runs in the foreground or not after a second set time length; and if the previous state of the target application program is detected to be running in the foreground, determining that the target application program is switched to be running in the background.
In some embodiments of the present invention, based on the foregoing scheme, the detection unit is configured to: and if the onActivityPaused method call-back is detected and the onActivityResummed method call-back is detected within a third set time length or after the third set time length, determining that the target application program runs in the foreground.
In some embodiments of the present invention, based on the foregoing scheme, the detection unit is configured to: and calling a system method for judging whether the application program is in foreground operation in the terminal in a reflection mode to determine whether the target application program is in foreground operation.
In a fourth aspect of embodiments of the present invention, there is provided a computing device comprising: a processor and a memory, the memory storing executable instructions, the processor being configured to invoke the memory stored executable instructions to perform the method according to the first aspect of the above embodiments.
According to the disconnected network reconnection method, the disconnected network reconnection medium, the disconnected network reconnection device and the computing equipment, the running state of the target application program is detected, and the corresponding reconnection strategy is used for reconnection when the network connection of the target application program is abnormal according to the running state, so that when the network connection of the application program is abnormal, the corresponding reconnection strategy can be adopted for reconnection based on the running state (such as the running state of foreground and background) of the application program, the problem that different disconnected network reconnection scenes are difficult to deal with due to the adoption of a fixed disconnected network reconnection strategy is solved, and the reasonability, the stability and the reliability of disconnected network reconnection are improved.
Drawings
The above and other objects, features and advantages of exemplary embodiments of the present invention will become readily apparent from the following detailed description read in conjunction with the accompanying drawings. Several embodiments of the invention are illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which:
FIG. 1 schematically illustrates a flow diagram of a method of reconnection of a disconnected network according to one embodiment of the present invention;
FIG. 2 is a diagram illustrating a specific process of reconnecting an application with a server according to an embodiment of the present invention;
fig. 3 schematically shows a block diagram of a network disconnection reconnecting device according to an embodiment of the present invention.
In the drawings, the same or corresponding reference numerals indicate the same or corresponding parts.
Detailed Description
The principles and spirit of the present invention will be described with reference to a number of exemplary embodiments. It is understood that these embodiments are given solely for the purpose of enabling those skilled in the art to better understand and to practice the invention, and are not intended to limit the scope of the invention in any way. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
As will be appreciated by one skilled in the art, embodiments of the present invention may be embodied as a system, apparatus, device, method, or computer program product. Thus, the present invention may be embodied in the form of: entirely hardware, entirely software (including firmware, resident software, micro-code, etc.), or a combination of hardware and software.
According to the embodiment of the invention, a disconnected network reconnection method, a disconnected network reconnection medium, a disconnected network reconnection device and a computing device are provided.
In this context, it should be understood that the term "running in the foreground" is referred to as the application displaying a window on the desktop of the terminal to run.
The term "running in the background" means that the application runs in the resource manager, and no interface is displayed on the desktop, but the application occupies system resources.
The term "network disconnection and reconnection" refers to reestablishing a connection at an appropriate time and with an appropriate reconnection interval when a connection (such as a TCP connection, Transmission Control Protocol) is disconnected.
The term "IM", collectively referred to as Instant Messaging, is a real-time Messaging service that allows users to establish some sort of private chat over a network. For example, WeChat, QQ, easy letter, strange, etc. are instant messaging software.
The term "IM SDK" is a set of software development tools that encapsulate the instant messaging capability, provide API (Application programming interface), development documentation, and usage paradigm, and help developers develop communication software quickly.
The term "heartbeat mechanism" refers to that a client sends a heartbeat message to a server every N seconds, and the server replies the same heartbeat message to the client after receiving the heartbeat message. If neither the server nor the client receives any messages including heartbeat messages within M seconds (M > N), i.e. the heartbeat times out, the TCP connection between the client and the server is considered to have been broken. The heartbeat mechanism is an important means for keeping the APP network alive.
Moreover, any number of elements in the drawings are by way of example and not by way of limitation, and any nomenclature is used solely for differentiation and not by way of limitation.
The principles and spirit of the present invention are explained in detail below with reference to several representative embodiments of the invention.
Summary of The Invention
The inventor finds that various problems generally exist in the conventional disconnected network reconnection mechanism, and different disconnected network reconnection scenes cannot be met.
Therefore, embodiments of the present invention provide a disconnected network reconnection method, medium, apparatus, and computing device, which can adopt a corresponding reconnection policy to reconnect based on an operating state of an application program, and solve a problem that it is difficult to cope with different disconnected network reconnection scenarios due to the adoption of a fixed disconnected network reconnection policy.
Having described the general principles of the invention, various non-limiting embodiments of the invention are described in detail below.
Application scene overview
It should be noted that the following application scenarios are merely illustrated to facilitate understanding of the spirit and principles of the present invention, and the embodiments of the present invention are not limited in this respect. Rather, embodiments of the present invention may be applied to any scenario where applicable.
Application scenario 1: in one embodiment of the invention, when the application program runs in the foreground, if the disconnection between the application program and the server is detected, but the local network of the terminal is normal, the application program is controlled to be immediately reconnected with the server.
Application scenario 2: in one embodiment of the invention, when the application runs in the background, if the disconnection between the application and the server is detected, but the local network of the terminal is normal, the application is controlled to reconnect with the server at a preset reconnection interval.
Application scenario 3: in an embodiment of the present invention, if the network connection is limited when the application program is switched to the background operation, the application program is controlled to reconnect with the server within a certain time when it is detected that the application program is switched from the background operation to the foreground operation.
Application scenario 4: in an embodiment of the present invention, if the network connection is not limited when the application program is switched to the background operation, the application program is controlled to send a heartbeat packet to the server when detecting that the application program is switched from the background operation to the foreground operation; and when the response message of the server for the heartbeat packet is not received within a certain time, controlling the application program to disconnect from the server and reconnect with the server.
Application scenario 5: in an embodiment of the present invention, when the application program is not connected to the server, if the push process of the application program receives a communication binding message between processes sent by the UI process, the application program is controlled to reconnect to the server.
Application scenario 6: in an embodiment of the present invention, when an application program is switched from a background to a foreground to run and the application program is in a state of establishing a network connection, if a duration of the application program in the state of establishing the network connection reaches a first set duration, the application program is controlled to reconnect with a server.
Application scenario 7: in one embodiment of the invention, when detecting that the local network of the terminal is in a disconnected state, monitoring a message of network state change; and when the information of the network state change is monitored, the control application program is reconnected with the server.
Exemplary method
In the following, in conjunction with the above application scenarios, a disconnected network reconnection method according to an exemplary embodiment of the present invention is described with reference to fig. 1 and 2.
Fig. 1 schematically shows a flowchart of a method of reconnection of a disconnected network according to an embodiment of the present invention.
Referring to fig. 1, a method for reconnecting a disconnected network according to an embodiment of the present invention includes the following steps:
step S110, detecting the running state of a target application program in a terminal, wherein the running state comprises whether the target application program runs in a foreground or in a background;
and step S120, according to the running state of the target application program, reconnecting the target application program by using a corresponding reconnection strategy when the network connection of the target application program is abnormal.
The technical scheme of the embodiment shown in fig. 1 enables that when the network connection of the application program is abnormal, a corresponding reconnection strategy can be adopted to reconnect based on the running state (such as the running state of a foreground and a background) of the application program, so that the problem that different disconnected network reconnection scenes are difficult to deal with due to the adoption of a fixed disconnected network reconnection strategy is solved, and the reasonability, stability and reliability of the disconnected network reconnection are improved.
The following describes how to detect the running state of the target application program and how to perform reconnection processing for different disconnected network reconnection scenarios.
Embodiment of detecting the running state of the target application:
example 1:
in an embodiment of the present invention, detecting an operation state of a target application in a terminal includes: and if the onActivityResummed method call-back is detected and the previous state of the target application program is detected to be in background operation, determining that the target application program is switched to the foreground operation.
It should be noted that the onactiyreummed method and the onactiypaused method are both used for monitoring the life cycle of Activity in the terminal, and when the previous state of the application program is running in the background, if the call back of the onactiyreummed method is detected, the application program is switched to the foreground to run.
Example 2:
in an embodiment of the present invention, detecting an operation state of a target application in a terminal includes: if the onActivityPaused method call back is detected, detecting whether the previous state of the target application program runs in the foreground or not after a second set time length; and if the previous state of the target application program is detected to be running in the foreground, determining that the target application program is switched to be running in the background.
In one embodiment of the present invention, the second set time period may be 500 ms.
Example 3:
in an embodiment of the present invention, detecting an operation state of a target application in a terminal includes: and if the onActivityPaused method call-back is detected and the onActivityResummed method call-back is detected within a third set time length or after the third set time length, determining that the target application program runs in the foreground.
In one embodiment of the present invention, the third set time period may be 500 ms.
Example 4:
in an embodiment of the present invention, detecting an operation state of a target application in a terminal includes: and calling a system method for judging whether the application program is in foreground operation in the terminal in a reflection mode to determine whether the target application program is in foreground operation.
In an embodiment of the present invention, for systems with Android N and above, it may be determined whether the application is running in the foreground by calling the ispoforground method in a reflective manner.
The embodiment of reconnection processing under different disconnected network reconnection scenes comprises the following steps:
example 1:
in an embodiment of the present invention, when a target application runs in a foreground, if it is detected that a connection between the target application and a server is disconnected but a local network of the terminal is normal, the target application is controlled to immediately reconnect with the server.
In this embodiment, when the target application is running in the foreground and the local network of the terminal is normal, it indicates that the network connection between the target application and the server is unstable, so that the target application can be controlled to immediately reconnect to the server.
In an embodiment of the present invention, if the target application fails to reconnect with the server, the network address of the server to which the target application needs to connect is replaced to control the target application to reconnect with other servers.
In this embodiment, if the target application fails to reconnect to the server, it indicates that the server may temporarily fail, and therefore the network address of the server to which the target application needs to connect may be replaced for reconnection.
In one embodiment of the invention, when the network address of the server to which the target application needs to be connected is replaced, the network address of the server to which the target application needs to be connected can be replaced by sequentially selecting the network addresses from the available server network address set until the reconnection is successful or the traversal of the network addresses in the server network address set is completed.
In one embodiment of the present invention, the set of network addresses of the servers may be assigned by a designated device Based on location information of the terminal, wherein the designated device may assign a server with better connectivity closer to the terminal, and the designated device may be a server such as an L BS (L position Based Service) server.
In an embodiment of the present invention, if traversing the network addresses in the server network address set is completed, the server network address set allocated by the designated device may be obtained again.
Example 2:
in one embodiment of the invention, when the target application runs in the background, if the target application is detected to be disconnected from the server but the local network of the terminal is normal, the target application is controlled to reconnect with the server at a preset reconnection interval.
In one embodiment of the invention, the predetermined reconnect interval is positively correlated with the number of reconnections.
In this embodiment, when the application runs in the background and the local network of the terminal is normal, if the connection between the application and the server is disconnected, it is indicated that the network of the application is limited or the server fails, so to avoid excessive power consumption, the reconnection may be performed at a larger reconnection interval, and as the number of reconnection times increases, it is indicated that the possibility of connection reestablishment gradually decreases, and therefore, the reconnection interval should also be extended accordingly.
It should be noted that when the terminal running the application is turned off, the application may also be considered to be running in the background.
Example 3:
in an embodiment of the present invention, if the network connection is limited when the target application program is switched to the background operation, when it is detected that the target application program is switched from the background operation to the foreground operation, the target application program is controlled to reconnect with the server within a first predetermined time.
In this embodiment, if the network connection is limited when the application switches to the background operation, the system will immediately recover its network when switching to the foreground operation, and at this time, a reconnection with the server should be attempted in a short time.
Example 4:
in an embodiment of the present invention, if the network connection is not limited when the target application program is switched to the background operation, the target application program is controlled to send a heartbeat packet to the server when it is detected that the target application program is switched from the background operation to the foreground operation; and if the response message of the server to the heartbeat packet is not received within second preset time, controlling the target application program to disconnect the server and reconnect the target application program.
In this embodiment, if the application program is switched to the background operation, it may happen that the connection established between the application program and the server has lost activity, so that the application program may be controlled to send a heartbeat packet to the server when it is detected that the application program is switched from the background operation to the foreground operation, and when a response message fed back by the server is not received, the application program is controlled to disconnect from the server and reconnect to the server.
Example 5:
in one embodiment of the invention, the running state of the target application further comprises whether the target application has established a connection with the server; according to the running state of the target application program, when the network connection of the target application program is abnormal, reconnection is carried out by using a corresponding reconnection strategy, wherein the reconnection strategy comprises the following steps: and when the target application program is not connected with the server, if the push process of the target application program receives a communication binding message between processes sent by a UI (user interface) process, controlling the target application program to be reconnected with the server.
In this embodiment, in the running process of the application program, a situation that the UI process is already hung (e.g., crashed or abnormally terminated) and the Push (Push) process is still running may occur, and because the UI process is hung, the Push process cannot monitor the notification of the switching between the foreground and the background of the application program any more, and at this time, if the UI process starts to bind the Push process, there is still no chance to immediately trigger reconnection, and a long time is to be waited. Therefore, when the push process of the application program receives the communication binding message between the processes sent by the UI process, the reconnection of the application program and the server can be controlled.
Example 6:
in one embodiment of the present invention, the running state further includes whether the target application is in a network connection state; according to the running state of the target application program, when the network connection of the target application program is abnormal, reconnection is carried out by using a corresponding reconnection strategy, wherein the reconnection strategy comprises the following steps: when the target application program is switched to the foreground from the background to run and is in the network connection state, if the time length of the target application program in the network connection state reaches a first set time length, the target application program is controlled to be reconnected with the server.
Example 7:
in an embodiment of the present invention, in some embodiments of the present invention, based on the foregoing scheme, the method further comprises: if the local network of the terminal is detected to be in a disconnected state, monitoring a message of network state change; and when the message of the network state change is monitored, controlling the target application program to reconnect with the server.
In the foregoing embodiments, a specific process of reconnecting the target application with the server may be as shown in fig. 2, and mainly includes the following steps:
in step S210, a counter is started to count.
In one embodiment of the present invention, if the target application program is running in the foreground and reconnecting is performed for the first time, after a first predetermined time period, the count of the counter is increased by 1; and if the target application program runs in the background and is reconnected for the first time, adding 1 to the count of the counter after a second preset time period.
In one embodiment of the present invention, the second predetermined period is a random value within a first predetermined interval, and a minimum value within the first predetermined interval is greater than the first predetermined period.
In an embodiment of the present invention, if the target application program is running in the foreground and is not reconnected for the first time, the count of the counter is increased by 1 every time a third predetermined time period passes; and if the target application program runs in the background and is not reconnected for the first time, adding 1 to the count of the counter every time a fourth preset time length passes.
In one embodiment of the present invention, the fourth predetermined period is a random value within a second predetermined interval, and the minimum value within the second predetermined interval is greater than or equal to the third predetermined period.
In an embodiment of the present invention, if the terminal is connected to a first network, the third predetermined time period is a first value; and if the terminal is connected with a second network, the third preset time length is a second value.
In an embodiment of the present invention, if the first network is a Wi-Fi network and the second network is a mobile communication network, the second value is greater than the first value.
In one embodiment of the invention, the values in the set of preset values are a predetermined value to the power 0 to the power N, N being an integer greater than or equal to 0. In one embodiment of the present invention, the predetermined value may be 2.
Step S220, if the value of the counter is equal to any value in the preset value set, a reconnect operation is started.
For example, if the preset value is 2, then the reconnect operation is initiated when the counter value equals 1,2,4,8,16,32,64 … ….
The following describes the network disconnection reconnection scheme in detail by taking instant messaging software as an example.
For instant messaging software, the network disconnection and reconnection mechanism proposed in the related art at present mainly has the following problems:
1. if thousands of connections are disconnected due to instant server failure and the reconnection time points of each client are basically consistent, a large number of connections are heaved when the server is recovered, huge impact is caused on the server, and the server is likely to be down again.
2. For some manufacturers' systems, when an APP (Application) is backed to a background and runs for a period of time, a process is suspended or an alarm clock and a JobScheduler are aligned and awakened to cause a heartbeat mechanism to fail, which may cause a network connection failure, but the network of the system is normal in the process. Therefore, if only the network state of the monitoring system is changed and then reconnection is carried out, there is no chance to carry out reconnection in the scene.
3. For some manufacturers' systems, when the APP is backed to the background and runs for a period of time, the network connection is limited, and finally, the problem that the connection is failed but no system callback is received may occur, and further, when the APP is backed to the foreground and runs, the SDK (Software Development Kit) does not sense the connection abnormality, and the reconnection is performed until a message is sent and network timeout or Socket I/O abnormality occurs, which may result in poor user experience.
4. The IM SDK framework of mainstream all can adopt the multiprocess framework to separate out the long connection of light-weight push process independent maintenance TCP, in order to reduce the probability that APP is retrieved by the system when backing to the background, also can realize the end inside push function of APP when the background operation simultaneously. However, some restrictions are imposed on the high-version Android system and some manufacturer systems, although the TCP connection of the push process can be maintained, the TCP connection cannot be handed to the UI process in an inter-process communication manner, and the UI process cannot process the received message and pop up a notification bar to the user, so that the real-time performance of the message cannot be guaranteed. In this particular scenario, it is not meaningful to maintain network connectivity, but only the overhead of system resources and power consumption is increased.
In view of the above problems, the embodiments of the present invention provide a corresponding solution, which mainly includes: monitoring APP foreground and background states, a network connection IP dynamic updating mechanism, a disconnected network reconnection scene and a countermeasure, and designing a reconnection interval, wherein the following parts are respectively explained in detail:
1. monitoring APP Foreground and background states
In a first modeThe scheme mainly uses a method for adding an Android API 14, namely application, register Activity L implementation callbacks, wherein a set of callback method is provided by the application through the interface and is used for a developer to intensively process Activity lifecycle events.
1) In the initial state, the default APP runs in the background.
2) From background to foreground
And if the onActivityResummed method callback is detected and the APP is operated in the background before, sending a notification to inform the APP to be switched to the foreground for operation.
3) Foreground switching directly to background
Upon detection of the onactive used method callback, a 500ms delay detection task is delivered. And when the detection is carried out after 500ms, if the last state of the APP is detected to be operated in the foreground, the APP is informed to be switched to the background operation.
4) Jump from Activity A to Activity B in the foreground (completed within 200 ms)
Normally, Activity jumps are all completed within 200ms, and more than 200ms will cause UI stuck behavior, in which the execution of the onPaused method of Activity A and the onResummed method of Activity B is experienced.
In the embodiment of the invention, a more than 200ms and more relaxed delay task time of 500ms can be set. If the onActityPaused method is detected to be executed first, a 500ms delay task is delivered, and then if the onActityResummed method is detected to be executed, the 500ms delay task is immediately removed, which indicates that the APP always runs in the foreground under the condition that the notification message of foreground and background switching is not sent.
5) Jump from Activity A to Activity B in the foreground (completed in more than 500 ms)
In an embodiment of the present invention, if it is detected that the onactive used method is executed first, a 500ms delay task is delivered, and detection is executed after 500ms, and at this time, it is found that the last state of the APP is running in the foreground, it is considered that the APP is switched to the background running, and then the APP is notified to fall back to the background running. And then detecting the execution of the onactiyreummed method, and immediately sending out a notice to inform the APP to return to the foreground operation if the last state of the APP is operated in the background.
Therefore, although the special scene can cause two notification messages of backing to the background operation and returning to the foreground operation to be sent out, the foreground and background states of the APP are not actually changed, and therefore the detection result of the foreground and background states of the APP is not influenced.
It should be noted that only the UI process can monitor the Activity lifecycle, and if the process in which the network connection is located is a non-UI process, the APP foreground and background states should be synchronized in real time by means of inter-process communication.
Mode two: obtaining current APP foreground state through reflection system method
In Android N and above systems, an ActivityManager native in a Framework source code of the system is a Binder interacting with ActivityManager and implements an iactitymanager interface, and a method for judging whether App is in a foreground state is provided in the iactitymanager: the class also provides the static method getDefault acquisition to get the IActivityManager instance. Therefore, the ispoforground method can be called in a reflection mode to determine the foreground and background states of the APP. As for obtaining the uid of the App, all currently running App processes can be obtained through the ActivityManager, and the corresponding process information is matched through the main process name of the current App, so that the process uid is obtained.
The detection scheme in mode two may be complementary to and complementary to the detection scheme in mode one.
2. Network connection IP dynamic update mechanism
For the instant communication system which needs to provide global service, servers need to be deployed all over the world, when a user logs in, an optimal server needs to be selected to access the service, therefore, the L BS service can be based on, so that the client can obtain the server which is closest to the client and has the best connectivity to connect, and the servers can also perform load balancing according to the server.
After the IM SDK is initialized, the IM SDK immediately requests a batch of server IP addresses from the L BS server of the IM L BS server automatically allocates a batch of server IP addresses closest to the user according to the requested client IP address and geographical location information (the geographical location information is an option) submitted by the client, and the IM SDK queues and caches the server IP addresses.
When the SDK needs to log in (here, logging can be understood as the SDK needing to connect to the server), the first IP address in the queue can be obtained to attempt to establish a TCP connection. If the establishment fails, the foreground and background states of the APP are obtained (for example, by the scheme in the above embodiment), and if the APP is in the foreground, the queue head is removed from the queue, and the next reconnection starts from the next IP address in the queue. If the APP is in the background, it is likely that the APP is not necessary to remove the queue head because the network usage of the APP is system limited. This detail is a very critical improvement since if a replacement IP address reconnect is essentially still unsuccessful in a restricted environment, continuing to replace an IP address will directly result in the IP address list being exhausted.
After the IP address is removed from the queue, if only the last address (the default domain name of the IM server is stored in the queue and is fixed) is left in the queue, the SDK starts an asynchronous task to initiate a request to an L BS server of the IM server and reacquires a batch of new IP addresses.
3. Disconnected network reconnection scene and countermeasure
In the embodiment of the invention, the IM SDK is internally provided with a disconnected network reconnection strategy, and when the user logs in successfully manually, if the SDK detects that the connection is disconnected, the SDK immediately informs the upper layer of the current online state and automatically reconnects at a proper time. Specifically, for different scenes and APP states, there are different reconnection strategies, specifically as follows:
scene one: the local network is disconnected.
The reason is as follows: no signal from the mobile network, a Wi-Fi network disconnection, the terminal being in flight mode, etc.
Reconnection strategy: in this case, the reconnection is not required immediately, and only the system broadcast (such as android.
Scene two: the APP runs in the foreground and the local network is normal, but the connection between the client and the server is broken.
The reason is as follows: the network link between the client and the server is unstable or the server fails temporarily.
Reconnection strategy: in this case, the reconnection may be immediate, and if the reconnection fails, the server IP address of the replacement connection is reconnected again, where the reconnection interval may be short.
Scene three: the APP runs in the background and the local network is normal, but the connection between the client and the server is broken.
Reason 1: when the APP falls back to the background operation, the process is alive but the network connection is limited.
Reconnection strategy: to avoid excessive power consumption, the reconnection interval may be increased appropriately. If the reconnection fails, the IP address of the connected server is not changed.
Reason 2: the server fails.
Reconnection strategy: as the number of reconnections increases, the probability of the server recovering in a short time is gradually reduced, so the reconnection interval should be prolonged (the multiple increases, and a maximum value is also needed). It should be noted that: the reconnection interval should not be fixed, but a random backoff strategy should be provided to avoid the disconnection of the clients when the server is down, then the reconnection time points of all the clients are very close, and after the server is recovered, all the clients at the same time point are simultaneously connected with the server to cause the server to be blocked and to be down again.
Scene four: the APP is switched to the background operation and the network is limited, and then the APP is switched to the foreground operation.
Reconnection strategy: after the APP is switched to the background, it is likely that the process is alive but the network connection is limited, the delivered heartbeat packet does not return, the network connection is disconnected, and the reconnection also fails. But when switching to the foreground, the system immediately resumes its network, at which time a reconnection should be attempted in a short time. At this time, the above-mentioned scheme of APP foreground and background monitoring needs to be used, and considering that the APP foreground and background status has practical use only after the SDK is successfully registered, the starting time of monitoring foreground and background switching is after the SDK is successfully registered (i.e. the connection is successfully established with the server before the SDK).
Scene five: after the APP is switched to the background or the terminal is switched to the screen, the process is suspended or the CPU is dormant, and then the APP is switched to the foreground to run.
Reconnection strategy: on some terminals, when the APP falls back to the background or goes off-screen, the network connection is not restricted, but the process is suspended, the alarm clock and Job are removed or are aligned to wake up. This situation is likely to cause the heartbeat mechanism to fail, i.e. the activity of the long connection cannot be maintained by sending heartbeat packets. When the APP is switched to the foreground operation, the long connection is likely to be disconnected, but the SDK is not sensed (the SDK state is still logged in), and then the Socket I/O abnormity occurs as long as the user sends a message, and then the APP is immediately reconnected.
Because the probability of the occurrence of such a scenario is continuously increased, in the embodiment of the present invention, in order to improve the user experience, when detecting that the APP is switched to the foreground, if it is found that the APP is currently in the logged-in state, a heartbeat packet is immediately sent to detect the connection activity, and if there is no packet returned within a short time (e.g., 5s), the connection is immediately and actively disconnected, and reconnection is started.
Scene six: the UI process is hung, the process where the long connection is located, namely the push process, is still alive, when the APP is in the background operation, the network can be limited, the push process is continuously failed to reconnect, and the reconnection time interval can be pulled to be very long by a random backoff strategy. Because the UI process is hung, the push process can not monitor the APP foreground and background switching notification any more, and at the moment, after the UI process is started and is bound with the push process, because the latest state synchronized to the SDK is still not logged in, and a foreground and background monitoring mechanism is not started, the UI process has no chance to immediately trigger reconnection and waits for a long time.
Reconnection strategy: if the process is automatically logged in and the current state is not logged in, the push process should immediately try reconnection after receiving the inter-process communication binding message sent by the UI process.
Scene seven: when the SDK is in a network connection establishment (connection) state, the process is immediately suspended after the APP falls back to a background or the terminal stops displaying. When the APP is switched to the foreground, the network connection state is still CONNECTING, and when the switching of the foreground and the background states triggers and tries to reconnect, the situation that if the current state is in the connection state, reconnection cannot be continued is judged, so that a deadlock is involved.
Reconnection strategy: each time a reconnection is attempted, the current connection status is checked and if it has been in connection for a long time, the reconnection is performed immediately.
3. Reconnection interval design (specific numerical value is only an example)
In an embodiment of the present invention, three variables may be defined:
delay: delay time for the first attempt to reconnect, if APP runs in the foreground, delay 1; if the APP runs in the background, delay is a random number in the range of 5-10.
period: reconnection interval time. If the APP runs in the foreground, the current network determines that: if the connection is a WI-FI network, period is 3, and if the connection is an operator network, period is 5; if the APP is in the background, period is a random number of 5-20.
reconnectCount: and the current reconnection task execution time counter is increased from 1.
The execution time of the reconnection task is jointly determined by delay and period, and the first execution occurs after the delay time.
When determining whether reconnection is needed, judging whether the recannectcount meets a certain condition, if so, executing reconnection, and if not, continuing waiting for period time. In an embodiment of the present invention, a random backoff strategy of power N of 2 may be employed, i.e., the reconnection is actually performed when the recannectcount equals 1,2,4,8,16,32, 64. In other words, the recannectcount will always count according to delay and period, and the reconnect operation will only be initiated if the value of recannectcount equals 1,2,4,8,16,32, 64.
The method comprises the steps of monitoring the states of a foreground and a background of the APP, selecting different reconnection intervals, ensuring that the APP can automatically and quickly recover network connection when the APP is in the foreground or is switched back to the foreground from the background, and improving user experience, wherein the N-th power random backoff strategy of 2 is adopted in the embodiment of the invention, so that the pressure of receiving connection by a server is dispersed to a certain extent, particularly when the server recovers from a fault, the huge impact on the server caused by network disconnection reconnection executed by all clients at the same time can be avoided, and unnecessary power consumption expense caused by limitation of network connection when the APP operates at the background is reduced.
Exemplary Medium
Having described the method of the exemplary embodiments of the present invention, the media of the exemplary embodiments of the present invention will be described next.
In some possible embodiments, aspects of the present invention may also be implemented as a medium having stored thereon program code for implementing steps in the method for disconnected network reconnection according to various exemplary embodiments of the present invention described in the above section "exemplary method" of this specification, when the program code is executed by a processor of a device.
Specifically, the processor of the device, when executing the program code, is configured to implement the following steps: detecting the running state of a target application program in a terminal, wherein the running state comprises whether the target application program runs in a foreground or in a background; and according to the running state of the target application program, reconnecting by using a corresponding reconnecting strategy when the network connection of the target application program is abnormal.
In some embodiments of the invention, the program code is executable by a processor of the device to perform the steps of: when the target application program runs in the foreground, if the situation that the connection between the target application program and the server is disconnected but the local network of the terminal is normal is detected, the target application program is controlled to be immediately reconnected with the server.
In some embodiments of the invention, the program code is further configured to, when executed by the processor of the device, perform the following steps: and if the target application program fails to be reconnected with the server, replacing the network address of the server to which the target application program needs to be connected so as to control the target application program to be reconnected with other servers.
In some embodiments of the invention, the program code is executable by a processor of the device to perform the steps of: and sequentially selecting network addresses from the available server network address set to replace the network addresses of the servers to which the target application program needs to be connected until the reconnection is successful or the traversal of the network addresses in the server network address set is completed.
In some embodiments of the invention, the program code is further configured to, when executed by the processor of the device, perform the following steps: and acquiring the server network address set distributed by the appointed equipment according to the position information of the terminal.
In some embodiments of the invention, the program code is further configured to, when executed by the processor of the device, perform the following steps: and if the network address in the server network address set is traversed, the server network address set distributed by the specified equipment is obtained again.
In some embodiments of the invention, the program code is executable by a processor of the device to perform the steps of: when the target application program runs in the background, if the fact that the connection between the target application program and the server is disconnected but the local network of the terminal is normal is detected, the target application program is controlled to be reconnected with the server at a preset reconnection interval.
In some embodiments of the present invention, based on the above scheme, the predetermined reconnection interval is positively correlated with the number of reconnections.
In some embodiments of the invention, the program code is executable by a processor of the device to perform the steps of: and if the network connection is limited when the target application program is switched to the background operation, controlling the target application program to reconnect with the server within first preset time when the target application program is detected to be switched from the background operation to the foreground operation.
In some embodiments of the invention, the program code is executable by a processor of the device to perform the steps of: if the network connection is not limited when the target application program is switched to the background operation, controlling the target application program to send a heartbeat packet to a server when the target application program is detected to be switched from the background operation to the foreground operation; and if the response message of the server to the heartbeat packet is not received within second preset time, controlling the target application program to disconnect the server and reconnect the target application program.
In some embodiments of the invention, the running state further comprises whether the target application has established a connection with a server; the program code is executed by a processor of the device to implement the following steps: when the target application program is not connected with the server, if a push process of the target application program receives a communication binding message between processes sent by a User Interface (UI) process, controlling the target application program to be reconnected with the server.
In some embodiments of the invention, the running state further comprises whether the target application is in a network connected state; the program code is executed by a processor of the device to implement the following steps: when the target application program is switched to the foreground from the background to run and is in the network connection state, if the time length of the target application program in the network connection state reaches a first set time length, the target application program is controlled to be reconnected with the server.
In some embodiments of the invention, the program code is further configured to, when executed by the processor of the device, perform the following steps: if the local network of the terminal is detected to be in a disconnected state, monitoring a message of network state change; and when the message of the network state change is monitored, controlling the target application program to reconnect with the server.
In some embodiments of the invention, the program code is executable by a processor of the device to perform the steps of: starting a counter to count; and if the value of the counter is equal to any value in a preset value set, starting reconnection operation.
In some embodiments of the invention, the program code is executable by a processor of the device to perform the steps of: if the target application program runs in the foreground and is reconnected for the first time, after a first preset time length, adding 1 to the count of the counter; and if the target application program runs in the background and is reconnected for the first time, adding 1 to the count of the counter after a second preset time period.
In some embodiments of the present invention, based on the above scheme, the second predetermined time period is a random value within a first predetermined interval, and a minimum value within the first predetermined interval is greater than the first predetermined time period.
In some embodiments of the invention, the program code is executable by a processor of the device to perform the steps of: if the target application program operates in the foreground and is not reconnected for the first time, the counting of the counter is increased by 1 every time a third preset time length passes; and if the target application program runs in the background and is not reconnected for the first time, adding 1 to the count of the counter every time a fourth preset time length passes.
In some embodiments of the present invention, based on the above scheme, the fourth predetermined time period is a random value within a second predetermined interval, and a minimum value within the second predetermined interval is greater than or equal to the third predetermined time period.
In some embodiments of the present invention, based on the foregoing scheme, if the terminal is connected to the first network, the third predetermined time period is a first value; and if the terminal is connected with a second network, the third preset time length is a second value.
In some embodiments of the present invention, based on the foregoing scheme, if the first network is a Wi-Fi network and the second network is a mobile communication network, the second value is greater than the first value.
In some embodiments of the invention, based on the above scheme, the values in the preset set of values are from 0 to N powers of a predetermined value, where N is an integer greater than or equal to 0.
In some embodiments of the invention, the predetermined value is 2 based on the foregoing scheme.
In some embodiments of the invention, the program code is executable by a processor of the device to perform the steps of: and if the onActivityResummed method call-back is detected and the previous state of the target application program is detected to be in background operation, determining that the target application program is switched to the foreground operation.
In some embodiments of the invention, the program code is executable by a processor of the device to perform the steps of: if the onActivityPaused method call back is detected, detecting whether the previous state of the target application program runs in the foreground or not after a second set time length; and if the previous state of the target application program is detected to be running in the foreground, determining that the target application program is switched to be running in the background.
In some embodiments of the invention, the program code is executable by a processor of the device to perform the steps of: and if the onActivityPaused method call-back is detected and the onActivityResummed method call-back is detected within a third set time length or after the third set time length, determining that the target application program runs in the foreground.
In some embodiments of the invention, the program code is executable by a processor of the device to perform the steps of: and calling a system method for judging whether the application program is in foreground operation in the terminal in a reflection mode to determine whether the target application program is in foreground operation.
It should be noted that: the above-mentioned medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take a variety of forms, including, but not limited to: an electromagnetic signal, an optical signal, or any suitable combination of the foregoing. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations of the present invention may be written in any combination of one or more programming languages, including AN object oriented programming language such as Java, C + +, or the like, as well as conventional procedural programming languages, such as the "C" language, or similar programming languages.
Exemplary devices
Having described the medium of an exemplary embodiment of the present invention, a web disconnection and reconnection apparatus according to an exemplary embodiment of the present invention will be described next with reference to fig. 3.
Fig. 3 schematically shows a block diagram of a network disconnection reconnecting device according to an embodiment of the present invention.
Referring to fig. 3, a grid disconnection reconnection apparatus 300 according to an embodiment of the present invention includes: a detection unit 302 and a reconnection processing unit 304.
The detection unit 302 is configured to detect an operation state of a target application in a terminal, where the operation state includes whether the target application is running in a foreground or in a background; the reconnection processing unit 304 is configured to reconnect, according to the running state of the target application program, according to a corresponding reconnection policy when the network connection of the target application program is abnormal.
In some embodiments of the present invention, based on the foregoing solution, the reconnection processing unit 304 is configured to: when the target application program runs in the foreground, if the situation that the connection between the target application program and the server is disconnected but the local network of the terminal is normal is detected, the target application program is controlled to be immediately reconnected with the server.
In some embodiments of the present invention, based on the foregoing solution, the reconnection processing unit 304 is further configured to: and if the target application program fails to be reconnected with the server, replacing the network address of the server to which the target application program needs to be connected so as to control the target application program to be reconnected with other servers.
In some embodiments of the present invention, based on the foregoing solution, the reconnection processing unit 304 is configured to: and sequentially selecting network addresses from the available server network address set to replace the network addresses of the servers to which the target application program needs to be connected until the reconnection is successful or the traversal of the network addresses in the server network address set is completed.
In some embodiments of the present invention, based on the foregoing solution, the apparatus 300 further includes: an obtaining unit 306, configured to obtain the server network address set allocated by the specified device according to the location information of the terminal.
In some embodiments of the present invention, based on the foregoing scheme, the obtaining unit 306 is further configured to: and if the network address in the server network address set is traversed, the server network address set distributed by the specified equipment is obtained again.
In some embodiments of the present invention, based on the foregoing solution, the reconnection processing unit 304 is configured to: when the target application program runs in the background, if the fact that the connection between the target application program and the server is disconnected but the local network of the terminal is normal is detected, the target application program is controlled to be reconnected with the server at a preset reconnection interval.
In some embodiments of the present invention, based on the above scheme, the predetermined reconnection interval is positively correlated with the number of reconnections.
In some embodiments of the present invention, based on the foregoing solution, the reconnection processing unit 304 is configured to: and if the network connection is limited when the target application program is switched to the background operation, controlling the target application program to reconnect with the server within first preset time when the target application program is detected to be switched from the background operation to the foreground operation.
In some embodiments of the present invention, based on the foregoing solution, the reconnection processing unit 304 is configured to: if the network connection is not limited when the target application program is switched to the background operation, controlling the target application program to send a heartbeat packet to a server when the target application program is detected to be switched from the background operation to the foreground operation; and if the response message of the server to the heartbeat packet is not received within second preset time, controlling the target application program to disconnect the server and reconnect the target application program.
In some embodiments of the present invention, based on the foregoing solution, the running status further includes whether the target application has established a connection with a server; the reconnect processing unit 304 is configured to: and when the target application program is not connected with the server, if the push process of the target application program receives a communication binding message between processes sent by a UI (user interface) process, controlling the target application program to be reconnected with the server.
In some embodiments of the present invention, based on the foregoing solution, the running state further includes whether the target application is in a network connection state; the reconnect processing unit 304 is configured to: when the target application program is switched to the foreground from the background to run and is in the network connection state, if the time length of the target application program in the network connection state reaches a first set time length, the target application program is controlled to be reconnected with the server.
In some embodiments of the present invention, based on the foregoing solution, the reconnection processing unit 304 is further configured to: if the local network of the terminal is detected to be in a disconnected state, monitoring a message of network state change; and when the message of the network state change is monitored, controlling the target application program to reconnect with the server.
In some embodiments of the present invention, based on the foregoing solution, the reconnection processing unit 304 includes: a counting unit 3042 for starting the counter to count; an execution unit 3044, configured to start a reconnect operation when the value of the counter is equal to any value in a preset value set.
In some embodiments of the present invention, based on the foregoing solution, the counting unit 3042 is configured to: if the target application program runs in the foreground and is reconnected for the first time, after a first preset time length, adding 1 to the count of the counter; and if the target application program runs in the background and is reconnected for the first time, adding 1 to the count of the counter after a second preset time period.
In some embodiments of the present invention, based on the above scheme, the second predetermined time period is a random value within a first predetermined interval, and a minimum value within the first predetermined interval is greater than the first predetermined time period.
In some embodiments of the present invention, based on the foregoing solution, the counting unit 3042 is configured to: if the target application program operates in the foreground and is not reconnected for the first time, the counting of the counter is increased by 1 every time a third preset time length passes; and if the target application program runs in the background and is not reconnected for the first time, adding 1 to the count of the counter every time a fourth preset time length passes.
In some embodiments of the present invention, based on the above scheme, the fourth predetermined time period is a random value within a second predetermined interval, and a minimum value within the second predetermined interval is greater than or equal to the third predetermined time period.
In some embodiments of the present invention, based on the foregoing scheme, if the terminal is connected to the first network, the third predetermined time period is a first value; and if the terminal is connected with a second network, the third preset time length is a second value.
In some embodiments of the present invention, based on the foregoing scheme, if the first network is a Wi-Fi network and the second network is a mobile communication network, the second value is greater than the first value.
In some embodiments of the invention, based on the above scheme, the values in the preset set of values are from 0 to N powers of a predetermined value, where N is an integer greater than or equal to 0.
In some embodiments of the invention, the predetermined value is 2 based on the foregoing scheme.
In some embodiments of the present invention, based on the foregoing scheme, the detecting unit 302 is configured to: and if the onActivityResummed method call-back is detected and the previous state of the target application program is detected to be in background operation, determining that the target application program is switched to the foreground operation.
In some embodiments of the present invention, based on the foregoing scheme, the detecting unit 302 is configured to: if the onActivityPaused method call back is detected, detecting whether the previous state of the target application program runs in the foreground or not after a second set time length; and if the previous state of the target application program is detected to be running in the foreground, determining that the target application program is switched to be running in the background.
In some embodiments of the present invention, based on the foregoing scheme, the detecting unit 302 is configured to: and if the onActivityPaused method call-back is detected and the onActivityResummed method call-back is detected within a third set time length or after the third set time length, determining that the target application program runs in the foreground.
In some embodiments of the present invention, based on the foregoing scheme, the detecting unit 302 is configured to: and calling a system method for judging whether the application program is in foreground operation in the terminal in a reflection mode to determine whether the target application program is in foreground operation.
Exemplary computing device
Having described the method, medium, and apparatus of exemplary embodiments of the present invention, a computing device in accordance with another exemplary embodiment of the present invention is described.
As will be appreciated by one skilled in the art, aspects of the present invention may be embodied as a system, method or program product. Thus, various aspects of the invention may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
In some possible implementations, a computing device according to an embodiment of the invention may include at least one processor, and at least one memory. Wherein the memory stores program code which, when executed by the processor, causes the processor to perform the steps of the method for reconnection to a disconnected network according to various exemplary embodiments of the present invention described in the section "exemplary method" above in this specification. For example, the processor may perform step S110 shown in fig. 1, and detect an operation state of a target application in a terminal, where the operation state includes whether the target application is running in the foreground or in the background; and step S120, according to the running state of the target application program, reconnecting the target application program by using a corresponding reconnection strategy when the network connection of the target application program is abnormal. As another example, the processor may also perform the steps as shown in fig. 2.
It should be noted that although in the above detailed description reference is made to several units or sub-units of the grid disconnect reconnecting device, such division is merely exemplary and not mandatory. Indeed, the features and functions of two or more modules or units described above may be embodied in one module or unit according to embodiments of the invention. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Moreover, while the operations of the method of the invention are depicted in the drawings in a particular order, this does not require or imply that the operations must be performed in this particular order, or that all of the illustrated operations must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions.
While the spirit and principles of the invention have been described with reference to several particular embodiments, it is to be understood that the invention is not limited to the particular embodiments disclosed, nor is the division of the aspects, which is for convenience only as the features in these aspects may not be combined to benefit from the present disclosure. The invention is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.

Claims (48)

1. A disconnected network reconnection method comprises the following steps:
detecting the running state of a target application program in a terminal, wherein the running state comprises whether the target application program runs in a foreground or in a background; the running state also comprises whether the target application program is connected with a server;
according to the running state of the target application program, reconnecting by using a corresponding reconnecting strategy when the network connection of the target application program is abnormal; according to the running state of the target application program, when the network connection of the target application program is abnormal, reconnection is carried out by using a corresponding reconnection strategy, wherein the reconnection strategy comprises the following steps: when the target application program runs in the foreground, if the situation that the connection between the target application program and the server is disconnected but the local network of the terminal is normal is detected, controlling the target application program to be immediately reconnected with the server;
according to the running state of the target application program, when the network connection of the target application program is abnormal, reconnection is carried out by using a corresponding reconnection strategy, wherein the reconnection strategy comprises the following steps: when the target application program runs in the background, if the situation that the connection between the target application program and the server is disconnected but the local network of the terminal is normal is detected, controlling the target application program to reconnect with the server at a preset reconnection interval; the predetermined reconnection interval has a positive correlation with the number of reconnection times.
2. The method of claim 1, further comprising:
and if the target application program fails to be reconnected with the server, replacing the network address of the server to which the target application program needs to be connected so as to control the target application program to be reconnected with other servers.
3. The method of claim 2, wherein replacing the network address of the server to which the target application needs to connect comprises:
and sequentially selecting network addresses from the available server network address set to replace the network addresses of the servers to which the target application program needs to be connected until the reconnection is successful or the traversal of the network addresses in the server network address set is completed.
4. The method of claim 3, further comprising:
and acquiring the server network address set distributed by the appointed equipment according to the position information of the terminal.
5. The method of claim 4, wherein the set of server network addresses assigned by the designated device is retrieved if traversing the network addresses in the set of server network addresses is completed.
6. The method of claim 1, wherein according to the running state of the target application, reconnecting with a corresponding reconnection policy when the network connection of the target application is abnormal, comprises:
and if the network connection is limited when the target application program is switched to the background operation, controlling the target application program to reconnect with the server within first preset time when the target application program is detected to be switched from the background operation to the foreground operation.
7. The method of claim 1, wherein according to the running state of the target application, reconnecting with a corresponding reconnection policy when the network connection of the target application is abnormal, comprises:
if the network connection is not limited when the target application program is switched to the background operation, controlling the target application program to send a heartbeat packet to a server when the target application program is detected to be switched from the background operation to the foreground operation;
and if the response message of the server to the heartbeat packet is not received within second preset time, controlling the target application program to disconnect the server and reconnect the target application program.
8. The method of claim 1, wherein the first and second light sources are selected from the group consisting of,
according to the running state of the target application program, when the network connection of the target application program is abnormal, reconnection is carried out by using a corresponding reconnection strategy, wherein the reconnection strategy comprises the following steps:
and when the target application program is not connected with the server, if the push process of the target application program receives a communication binding message between processes sent by a UI (user interface) process, controlling the target application program to be reconnected with the server.
9. The method of claim 1, wherein the running state further comprises whether the target application is in a network connected state;
according to the running state of the target application program, when the network connection of the target application program is abnormal, reconnection is carried out by using a corresponding reconnection strategy, wherein the reconnection strategy comprises the following steps:
when the target application program is switched to the foreground from the background to run and is in the network connection state, if the time length of the target application program in the network connection state reaches a first set time length, the target application program is controlled to be reconnected with the server.
10. The method of claim 1, further comprising:
if the local network of the terminal is detected to be in a disconnected state, monitoring a message of network state change;
and when the message of the network state change is monitored, controlling the target application program to reconnect with the server.
11. The method of any one of claims 1 to 10, wherein the reconnecting comprises:
starting a counter to count;
and if the value of the counter is equal to any value in a preset value set, starting reconnection operation.
12. The method of claim 11, wherein starting a counter to count comprises:
if the target application program runs in the foreground and is reconnected for the first time, after a first preset time length, adding 1 to the count of the counter;
and if the target application program runs in the background and is reconnected for the first time, adding 1 to the count of the counter after a second preset time period.
13. The method of claim 12, wherein the second predetermined length of time is a random value within a first predetermined interval, and the minimum value within the first predetermined interval is greater than the first predetermined length of time.
14. The method of claim 11, wherein starting a counter to count comprises:
if the target application program operates in the foreground and is not reconnected for the first time, the counting of the counter is increased by 1 every time a third preset time length passes;
and if the target application program runs in the background and is not reconnected for the first time, adding 1 to the count of the counter every time a fourth preset time length passes.
15. The method of claim 14, wherein the fourth predetermined period of time is a random value within a second predetermined interval, and the minimum value within the second predetermined interval is greater than or equal to the third predetermined period of time.
16. The method according to claim 14, wherein if the terminal is connected to the first network, the third predetermined time period is a first value; and if the terminal is connected with a second network, the third preset time length is a second value.
17. The method of claim 16, wherein the second value is greater than the first value if the first network is a Wi-Fi network and the second network is a mobile communication network.
18. The method of claim 11, wherein the values in the set of preset values are a predetermined value to the power of 0 to the power of N, N being an integer greater than or equal to 0.
19. The method of claim 18, wherein the predetermined value is 2.
20. The method according to any one of claims 1 to 10, wherein detecting the running state of the target application in the terminal comprises:
and if the onActivityResummed method call-back is detected and the previous state of the target application program is detected to be in background operation, determining that the target application program is switched to the foreground operation.
21. The method according to any one of claims 1 to 10, wherein detecting the running state of the target application in the terminal comprises:
if the onActivityPaused method call back is detected, detecting whether the previous state of the target application program runs in the foreground or not after a second set time length;
and if the previous state of the target application program is detected to be running in the foreground, determining that the target application program is switched to be running in the background.
22. The method according to any one of claims 1 to 10, wherein detecting the running state of the target application in the terminal comprises:
and if the onActivityPaused method call-back is detected and the onActivityResummed method call-back is detected within a third set time length or after the third set time length, determining that the target application program runs in the foreground.
23. The method according to any one of claims 1 to 10, wherein detecting the running state of the target application in the terminal comprises:
and calling a system method for judging whether the application program is in foreground operation in the terminal in a reflection mode to determine whether the target application program is in foreground operation.
24. A computer storage medium having stored thereon a program which, when executed by a processor, carries out the method of any one of claims 1 to 23.
25. A web disconnect reconnect device comprising:
the terminal comprises a detection unit, a processing unit and a processing unit, wherein the detection unit is used for detecting the running state of a target application program in the terminal, and the running state comprises whether the target application program runs in the foreground or in the background; the running state also comprises whether the target application program is connected with a server;
the reconnection processing unit is used for performing reconnection according to the running state of the target application program by using a corresponding reconnection strategy when the network connection of the target application program is abnormal;
the reconnect processing unit is configured to: when the target application program runs in the foreground, if the situation that the connection between the target application program and the server is disconnected but the local network of the terminal is normal is detected, controlling the target application program to be immediately reconnected with the server;
when the target application program runs in the background, if the situation that the connection between the target application program and the server is disconnected but the local network of the terminal is normal is detected, controlling the target application program to reconnect with the server at a preset reconnection interval; the predetermined reconnection interval has a positive correlation with the number of reconnection times.
26. The apparatus of claim 25, wherein the reconnection processing unit is further to:
and if the target application program fails to be reconnected with the server, replacing the network address of the server to which the target application program needs to be connected so as to control the target application program to be reconnected with other servers.
27. The apparatus of claim 26, wherein the reconnection processing unit is configured to:
and sequentially selecting network addresses from the available server network address set to replace the network addresses of the servers to which the target application program needs to be connected until the reconnection is successful or the traversal of the network addresses in the server network address set is completed.
28. The apparatus of claim 27, further comprising:
and the acquisition unit is used for acquiring the server network address set distributed by the appointed equipment according to the position information of the terminal.
29. The apparatus of claim 28, wherein the obtaining unit is further configured to: and if the network address in the server network address set is traversed, the server network address set distributed by the specified equipment is obtained again.
30. The apparatus of claim 25, wherein the reconnection processing unit is configured to:
and if the network connection is limited when the target application program is switched to the background operation, controlling the target application program to reconnect with the server within first preset time when the target application program is detected to be switched from the background operation to the foreground operation.
31. The apparatus of claim 25, wherein the reconnection processing unit is configured to:
if the network connection is not limited when the target application program is switched to the background operation, controlling the target application program to send a heartbeat packet to a server when the target application program is detected to be switched from the background operation to the foreground operation;
and if the response message of the server to the heartbeat packet is not received within second preset time, controlling the target application program to disconnect the server and reconnect the target application program.
32. The apparatus of claim 25, wherein,
the reconnect processing unit is configured to:
and when the target application program is not connected with the server, if the push process of the target application program receives a communication binding message between processes sent by a UI (user interface) process, controlling the target application program to be reconnected with the server.
33. The apparatus of claim 25, wherein the running state further comprises whether the target application is in a network connected state;
the reconnect processing unit is configured to:
when the target application program is switched to the foreground from the background to run and is in the network connection state, if the time length of the target application program in the network connection state reaches a first set time length, the target application program is controlled to be reconnected with the server.
34. The apparatus of claim 25, wherein the reconnection processing unit is further to:
if the local network of the terminal is detected to be in a disconnected state, monitoring a message of network state change;
and when the message of the network state change is monitored, controlling the target application program to reconnect with the server.
35. The apparatus of any of claims 25 to 34, wherein the reconnection processing unit comprises:
the counting unit is used for starting the counter to count;
and the execution unit is used for starting reconnection operation when the value of the counter is equal to any value in a preset value set.
36. The apparatus of claim 35, wherein the counting unit is configured to:
if the target application program runs in the foreground and is reconnected for the first time, after a first preset time length, adding 1 to the count of the counter;
and if the target application program runs in the background and is reconnected for the first time, adding 1 to the count of the counter after a second preset time period.
37. The apparatus of claim 36, wherein the second predetermined length of time is a random value within a first predetermined interval, and a minimum value within the first predetermined interval is greater than the first predetermined length of time.
38. The apparatus of claim 35, wherein the counting unit is configured to:
if the target application program operates in the foreground and is not reconnected for the first time, the counting of the counter is increased by 1 every time a third preset time length passes;
and if the target application program runs in the background and is not reconnected for the first time, adding 1 to the count of the counter every time a fourth preset time length passes.
39. The apparatus of claim 38, wherein the fourth predetermined period of time is a random value within a second predetermined interval, and a minimum value within the second predetermined interval is greater than or equal to the third predetermined period of time.
40. The apparatus of claim 38, wherein the third predetermined time period is a first value if the terminal is connected to a first network; and if the terminal is connected with a second network, the third preset time length is a second value.
41. The apparatus of claim 40, wherein the second value is greater than the first value if the first network is a Wi-Fi network and the second network is a mobile communication network.
42. The apparatus of claim 35, wherein values in the preset set of values are 0 to nth power of a predetermined value, the N being an integer greater than or equal to 0.
43. The apparatus of claim 42, wherein the predetermined value is 2.
44. The apparatus of any of claims 25 to 34, wherein the detection unit is configured to:
and if the onActivityResummed method call-back is detected and the previous state of the target application program is detected to be in background operation, determining that the target application program is switched to the foreground operation.
45. The apparatus of any of claims 25 to 34, wherein the detection unit is configured to:
if the onActivityPaused method call back is detected, detecting whether the previous state of the target application program runs in the foreground or not after a second set time length;
and if the previous state of the target application program is detected to be running in the foreground, determining that the target application program is switched to be running in the background.
46. The apparatus of any of claims 25 to 34, wherein the detection unit is configured to:
and if the onActivityPaused method call-back is detected and the onActivityResummed method call-back is detected within a third set time length or after the third set time length, determining that the target application program runs in the foreground.
47. The apparatus of any of claims 25 to 34, wherein the detection unit is configured to:
and calling a system method for judging whether the application program is in foreground operation in the terminal in a reflection mode to determine whether the target application program is in foreground operation.
48. A computing device, comprising: a processor and a memory, the memory storing executable instructions, the processor to invoke the memory-stored executable instructions to perform the method of any of claims 1 to 23.
CN201810174494.3A 2018-03-02 2018-03-02 Disconnected network reconnection method, medium, device and computing equipment Active CN108430116B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810174494.3A CN108430116B (en) 2018-03-02 2018-03-02 Disconnected network reconnection method, medium, device and computing equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810174494.3A CN108430116B (en) 2018-03-02 2018-03-02 Disconnected network reconnection method, medium, device and computing equipment

Publications (2)

Publication Number Publication Date
CN108430116A CN108430116A (en) 2018-08-21
CN108430116B true CN108430116B (en) 2020-08-07

Family

ID=63157497

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810174494.3A Active CN108430116B (en) 2018-03-02 2018-03-02 Disconnected network reconnection method, medium, device and computing equipment

Country Status (1)

Country Link
CN (1) CN108430116B (en)

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110881224B (en) * 2018-09-06 2021-11-09 广州虎牙信息科技有限公司 Network long connection method, device, equipment and storage medium
CN110896569B (en) * 2018-09-12 2021-09-07 武汉斗鱼网络科技有限公司 Bullet screen automatic reconnection method, storage medium, electronic equipment and system
JP6635525B1 (en) 2018-10-29 2020-01-29 Necプラットフォームズ株式会社 Exchange, communication system, registration method and registration program
CN109529332B (en) * 2018-11-28 2021-09-17 珠海金山网络游戏科技有限公司 Game scene motion state switching method and device, server and terminal
CN109756888B (en) * 2019-01-03 2021-07-06 中国—东盟信息港股份有限公司 eSIM service keep-alive system for terminals of different brands
CN111262941B (en) * 2020-01-17 2021-08-20 杭州涂鸦信息技术有限公司 Method for reconnecting cloud server and electronic equipment
CN111586111B (en) * 2020-04-23 2022-08-30 北京踏歌智行科技有限公司 Networking method for communication fault states of cluster unmanned vehicles
CN113573383B (en) * 2020-04-29 2023-04-07 京东方科技集团股份有限公司 Re-network access method after mobile terminal network disconnection and related equipment
CN112087772B (en) * 2020-10-10 2023-04-07 Oppo(重庆)智能科技有限公司 Network anomaly recovery method, terminal and computer storage medium
CN112702403B (en) * 2020-12-17 2023-04-07 深圳市新国都通信技术有限公司 Intelligent service connection method based on re-networking and communication module
CN113098972B (en) * 2021-04-12 2023-01-31 京东科技信息技术有限公司 Method and device for connecting with equipment, electronic equipment and storage medium
CN113542359B (en) * 2021-06-17 2023-09-05 聚好看科技股份有限公司 Terminal state updating method and device in online conference and electronic equipment
CN114710569A (en) * 2022-03-11 2022-07-05 珠海派诺科技股份有限公司 Self-scaling TCP link maintenance method, system and storage medium
CN114884920B (en) * 2022-07-07 2022-11-25 荣耀终端有限公司 Communication method, electronic equipment and storage medium
CN116232856A (en) * 2022-12-06 2023-06-06 博泰车联网科技(上海)股份有限公司 Network anomaly recovery method and device, storage medium and electronic equipment
CN116055227B (en) * 2023-03-31 2023-06-16 北京国信会视科技有限公司 Intelligent terminal management and control method, system and device based on android device online security

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2273763A1 (en) * 2009-06-26 2011-01-12 France Telecom System and method for detecting connection loss between a gateway and an application service
CN104301318A (en) * 2014-10-15 2015-01-21 北京国信灵通网络科技有限公司 Network reconnection method and device used for instant messaging application
CN104376012A (en) * 2013-08-14 2015-02-25 腾讯科技(深圳)有限公司 Web page application reconnection method, web page application reconnection device and web page application reconnection system
CN105684485A (en) * 2013-11-01 2016-06-15 汤姆逊许可公司 Methods for a link recovery of a wireless network and respective devices
CN107332735A (en) * 2017-07-04 2017-11-07 四川长虹技佳精工有限公司 The network communication method of Auto-reconnect after disconnection

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102955560B (en) * 2011-08-25 2015-02-04 腾讯科技(深圳)有限公司 Application program processing method and device
CN104991850B (en) * 2015-06-27 2018-06-19 广州华多网络科技有限公司 The heartbeat packet control method and device of a kind of application program
CN105871977A (en) * 2015-11-27 2016-08-17 乐视体育文化产业发展(北京)有限公司 Long connection establishment method and system, and devices
CN105893129B (en) * 2016-03-30 2020-01-07 北京小米移动软件有限公司 Method and device for processing application program in terminal
CN106507416A (en) * 2016-11-29 2017-03-15 深圳天珑无线科技有限公司 Data pack transmission method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2273763A1 (en) * 2009-06-26 2011-01-12 France Telecom System and method for detecting connection loss between a gateway and an application service
CN104376012A (en) * 2013-08-14 2015-02-25 腾讯科技(深圳)有限公司 Web page application reconnection method, web page application reconnection device and web page application reconnection system
CN105684485A (en) * 2013-11-01 2016-06-15 汤姆逊许可公司 Methods for a link recovery of a wireless network and respective devices
CN104301318A (en) * 2014-10-15 2015-01-21 北京国信灵通网络科技有限公司 Network reconnection method and device used for instant messaging application
CN107332735A (en) * 2017-07-04 2017-11-07 四川长虹技佳精工有限公司 The network communication method of Auto-reconnect after disconnection

Also Published As

Publication number Publication date
CN108430116A (en) 2018-08-21

Similar Documents

Publication Publication Date Title
CN108430116B (en) Disconnected network reconnection method, medium, device and computing equipment
US10715411B1 (en) Altering networking switch priority responsive to compute node fitness
US10693813B1 (en) Enabling and disabling links of a networking switch responsive to compute node fitness
AU2018232915B2 (en) System and method for introducing functionality to an application for use with a network service
EP2871553B1 (en) Systems and methods for protecting virtualized assets
TW201944236A (en) Task processing method, apparatus, and system
EP3550436A1 (en) Method and apparatus for detecting and recovering fault of virtual machine
US11310100B1 (en) EMS resolution of split-brain virtual network function components
JP2001101033A (en) Fault monitoring method for operating system and application program
EP2598993A1 (en) Providing application high availability in highly-available virtual machine environments
JP2005209191A (en) Remote enterprise management of high availability system
JP6354901B2 (en) Virtual machine failure detection and recovery management system
CN110618864A (en) Interrupt task recovery method and device
JP2005301436A (en) Cluster system and failure recovery method for it
CN111314443A (en) Node processing method, device and equipment based on distributed storage system and medium
JP6421516B2 (en) Server device, redundant server system, information takeover program, and information takeover method
CN107896176B (en) Processing method of computing node, intelligent terminal and storage medium
CN114826886B (en) Disaster recovery method and device for application software and electronic equipment
CN107341026B (en) Method and device for controlling driver
JP2003186681A (en) Multiple computer system
JP6856574B2 (en) Service continuation system and service continuation method
US20230315497A1 (en) Waiting period determination using an agent
US11874722B2 (en) Applying modern standby configurations on a per-application basis
WO2023228233A1 (en) Network management for automatic recovery in event of failure
US20070030813A1 (en) Monitoring a problem condition in a communications protocol implementation

Legal Events

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

Effective date of registration: 20210930

Address after: 310000 Room 408, building 3, No. 399, Wangshang Road, Changhe street, Binjiang District, Hangzhou City, Zhejiang Province

Patentee after: Hangzhou Netease Zhiqi Technology Co.,Ltd.

Address before: 310052 Room 301, Building No. 599, Changhe Street Network Business Road, Binjiang District, Hangzhou City, Zhejiang Province

Patentee before: HANGZHOU LANGHE TECHNOLOGY Ltd.

TR01 Transfer of patent right