CN111262941A - Method for reconnecting cloud server and electronic equipment - Google Patents

Method for reconnecting cloud server and electronic equipment Download PDF

Info

Publication number
CN111262941A
CN111262941A CN202010054947.6A CN202010054947A CN111262941A CN 111262941 A CN111262941 A CN 111262941A CN 202010054947 A CN202010054947 A CN 202010054947A CN 111262941 A CN111262941 A CN 111262941A
Authority
CN
China
Prior art keywords
failure
network
cloud server
reason
time
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.)
Granted
Application number
CN202010054947.6A
Other languages
Chinese (zh)
Other versions
CN111262941B (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 Tuya Information Technology Co Ltd
Original Assignee
Hangzhou Tuya Information 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 Tuya Information Technology Co Ltd filed Critical Hangzhou Tuya Information Technology Co Ltd
Priority to CN202010054947.6A priority Critical patent/CN111262941B/en
Publication of CN111262941A publication Critical patent/CN111262941A/en
Priority to PCT/CN2020/141613 priority patent/WO2021143533A1/en
Application granted granted Critical
Publication of CN111262941B publication Critical patent/CN111262941B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0631Management of faults, events, alarms or notifications using root cause analysis; using analysis of correlation between notifications, alarms or events based on decision criteria, e.g. hierarchy, tree or time analysis
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0631Management of faults, events, alarms or notifications using root cause analysis; using analysis of correlation between notifications, alarms or events based on decision criteria, e.g. hierarchy, tree or time analysis
    • H04L41/064Management of faults, events, alarms or notifications using root cause analysis; using analysis of correlation between notifications, alarms or events based on decision criteria, e.g. hierarchy, tree or time analysis involving time analysis
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0654Management of faults, events, alarms or notifications using network fault recovery

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The disclosure relates to a method for reconnecting a cloud server and an electronic device, comprising: responding to the disconnection of the network connection with the cloud server, and determining the fault reason of the disconnection; based on the determined fault reason, executing network state detection according to a time strategy corresponding to the fault reason until the fault is eliminated; and sending a reconnection request to the cloud server, and reestablishing the network connection with the cloud server. The embodiment of the disclosure can reduce the performance impact on the cloud.

Description

Method for reconnecting cloud server and electronic equipment
Technical Field
The present disclosure relates to the field of communications, and in particular, to a method for reconnecting a cloud server and an electronic device.
Background
The MQTT (message queue telemetry transport) protocol is used for real-time communication between equipment and the cloud, and when the MQTT is disconnected due to local network reasons or cloud abnormity, the equipment generally restarts the MQTT connection in the next second so as to recover the MQTT communication with the cloud as soon as possible.
The mechanism of this kind of reconnection is disadvantageous in that if the cloud end is abnormal, all devices connected to the cloud end at this time can break the MQTT connection at the same time, and then can initiate the MQTT connection at the next second at the same time, and when the number of devices is large, a large amount of devices initiate the MQTT connection at the same time, which may cause the cloud end to continue to be abnormal, and cannot recover.
Disclosure of Invention
The disclosure provides a technical scheme for reconnecting a cloud server.
According to an aspect of the present disclosure, there is provided a method of reconnecting a cloud server, including:
responding to the disconnection of the network connection with the cloud server, and determining the fault reason of the disconnection;
based on the determined fault reason, executing network state detection according to a time strategy corresponding to the fault reason until the fault is eliminated;
and sending a reconnection request to the cloud server, and reestablishing the network connection with the cloud server.
In some possible embodiments, the determining the cause of the disconnection failure includes:
under the condition that the wired network is connected through the wired network and the wired network signal cannot be detected, determining that the fault reason is a first fault reason;
under the condition of wireless networking and no wireless network signal detection, determining that the fault reason is a first fault reason;
under the condition that a network signal is detected and a domain name system is accessed unsuccessfully, determining that the failure reason is a first failure reason;
and in the case that the network signal is detected and the access to the domain name system is successful, determining that the failure reason is a second failure reason.
In some possible embodiments, the performing, based on the determined failure cause and according to a time policy corresponding to the failure cause, the network state detection until the failure is resolved includes:
responding to the fault reason as a first fault reason, and detecting the network state according to a preset time interval until the first fault reason is eliminated;
and responding to the second fault reason, determining the back-off time according to a preset algorithm, and detecting the network state based on the back-off time until the second fault reason is eliminated.
In some possible embodiments, the determining the back-off time according to the preset algorithm includes:
acquiring a random number and the number of times of currently detecting the network state;
and determining the back-off time based on the random number and the times according to a preset algorithm.
In some possible embodiments, the expression of the preset algorithm is: t ═ min (M, rand ()% (5000+ failcnt × 1000));
where t denotes a back-off time, min denotes a minimum function, M is a set reference comparison value, rand ()% is a random function for generating random numbers, and failcnt denotes the number of times of detecting a network state.
In some possible embodiments, the first cause of failure comprises a failure with a local network,
the responding to the failure reason is the first failure reason, and detecting the network state according to the preset time interval until the first failure reason is eliminated comprises:
responding to the failure reason as a first failure reason, and detecting the connection state of the local network according to a preset interval;
in case of detecting the connection to the local network, the detection of the network status is stopped.
In some possible embodiments, the second cause of failure comprises a cloud server failure,
the detecting the network state based on the back-off time until the second fault reason is eliminated comprises:
detecting whether a second fault reason still exists or not under the condition that the back-off time is reached;
if so, updating the back-off time based on the preset algorithm;
and if not, determining to eliminate the second fault reason.
In some possible embodiments, the method further comprises:
resetting the number of times of detecting the network state to an initial value in a case where the second cause of failure is eliminated.
In some possible embodiments, the sending a reconnection request to the cloud server to reestablish a network connection with the cloud server includes:
sending a reconnection request to the cloud server based on a message queue telemetry transmission protocol;
and responding to the return information of the cloud server, and reconnecting to establish network connection with the cloud server.
According to a second aspect of embodiments of the present disclosure, there is provided an electronic apparatus including:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to invoke the memory-stored instructions to perform the method of any of the first aspects.
In the embodiment of the disclosure, when it is detected that the device is disconnected from the cloud server, a failure reason of disconnection is determined first; based on the determined fault reason, the network state detection can be executed according to the time strategy corresponding to the fault reason until the fault is eliminated; and sending a reconnection request to the cloud server under the condition that the fault is eliminated, and reconnecting to establish network connection with the cloud server. The device can execute different time strategies according to the failure reason, detect the network state, and send a reconnection request to the server when the failure is detected to be eliminated. That is to say, this disclosed embodiment can carry out different time strategies according to the trouble reason, and different equipment can carry out the detection of network state according to the time value that the time strategy obtained to can make at least some equipment send the reconnection request to the cloud end server and can be staggered, reduce the pressure of cloud end server, this disclosed embodiment not only can resume the communication with the cloud end server as early as possible, can reduce the equipment quantity of connecting the cloud end simultaneously again, reduce the performance impact to the cloud end promptly.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Other features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments, which proceeds with reference to the accompanying drawings.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure.
Fig. 1 shows a flow diagram of reconnecting a cloud server according to an embodiment of the present disclosure;
fig. 2 shows a flowchart of step S30 in the method of reconnecting the cloud server according to the embodiment of the present disclosure;
fig. 3 shows a flowchart of step S40 in reconnecting the cloud server according to an embodiment of the present disclosure;
fig. 4 is a schematic diagram illustrating a process of reconnecting a cloud server according to an embodiment of the present disclosure;
fig. 5 shows a block diagram of an apparatus for reconnecting a cloud server according to an embodiment of the present disclosure;
FIG. 6 illustrates a block diagram of an electronic device 800 in accordance with an embodiment of the disclosure;
fig. 7 illustrates a block diagram of another electronic device 1900 in accordance with an embodiment of the disclosure.
Detailed Description
Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. In the drawings, like reference numbers can indicate functionally identical or similar elements. While the various aspects of the embodiments are presented in drawings, the drawings are not necessarily drawn to scale unless specifically indicated.
The word "exemplary" is used exclusively herein to mean "serving as an example, embodiment, or illustration. Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments.
The term "and/or" herein is merely an association describing an associated object, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of A, B, C, and may mean including any one or more elements selected from the group consisting of A, B and C.
Furthermore, in the following detailed description, numerous specific details are set forth in order to provide a better understanding of the present disclosure. It will be understood by those skilled in the art that the present disclosure may be practiced without some of these specific details. In some instances, methods, means, elements and circuits that are well known to those skilled in the art have not been described in detail so as not to obscure the present disclosure.
In the embodiment of the present disclosure, the execution subject of the method for reconnecting the server may be any electronic device connected with the cloud server. For example, the method of reconnecting the cloud server may be performed by a terminal device, where the terminal device may be a User Equipment (UE), a mobile device, a User terminal, a cellular phone, a cordless phone, a Personal Digital Assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, and the like. In some possible implementations, the method of reconnecting the cloud server may be implemented by a processor calling computer readable instructions stored in a memory.
Fig. 1 shows a flowchart of reconnecting a cloud server according to an embodiment of the present disclosure, and as shown in fig. 1, the method of reconnecting a cloud server may include:
s10: responding to the disconnection of the network connection with the cloud server, and determining the fault reason of the disconnection;
s20: based on the determined fault reason, executing network state detection according to a time strategy corresponding to the fault reason until the fault is eliminated;
s30: and sending a reconnection request to the cloud server, and reestablishing the network connection with the cloud server.
In some possible embodiments, at least one electronic device may be connected to the cloud server, and configured to perform operations such as data interaction and device control with the cloud server. For example, in an internet of things environment, a connection may be established between a plurality of home devices and a cloud server, and each home device is controlled or managed by the cloud server, but the above description is not a specific limitation of the present disclosure. The communication between the electronic device and the cloud server may be implemented using a Message Queue Telemetry Transport (MQTT) protocol, but is not a specific limitation of the present disclosure.
In some possible embodiments, the networking between the electronic device and the cloud server may be disconnected due to a network connection failure local to the electronic device or a failure of the cloud server. For example, when the electronic device sends information to the cloud server, if the corresponding return information cannot be detected within a preset time, or when access to the cloud server fails, it may be determined that the electronic device is disconnected from the cloud server. The electronic device may first determine a failure cause of the network disconnection with the cloud server when detecting the network disconnection with the cloud server, where the failure cause may include a local network failure and a cloud network failure. In the following embodiments, the first failure cause is a local network failure, and the second failure cause is a cloud network failure.
In some possible embodiments, determining the failure cause of the device disconnecting from the cloud server may include at least one of the following:
A1) under the condition that the wired network is connected through the wired network and the wired network signal cannot be detected, determining that the fault reason is a first fault reason;
in the embodiment of the disclosure, under the condition that the electronic device is disconnected from the cloud server, the current networking mode of the electronic device can be detected, and the networking mode can include wired networking and wireless networking. When the electronic equipment is connected with the network through the wire, whether the network interface is powered on or not can be judged, so that whether a network signal exists or not is detected, and if not, the fault reason is determined to be the first fault reason.
A2) Under the condition of wireless networking and no wireless network signal detection, determining that the fault reason is a first fault reason;
in the embodiment of the disclosure, when it is detected that the networking mode of the electronic device is wireless networking (such as wifi, bluetooth, gateway), it may be determined whether a network signal can be detected, and if not, it is determined that the failure cause is the first failure cause.
A3) In the case that a network signal is detected and a Domain Name System (DNS) access fails, determining that the failure cause is a first failure cause;
in the embodiment of the present disclosure, whether the electronic device is wired or wireless, when a network signal is detected, it may be further detected whether domain name access (DNS access) is successfully performed, in some examples, there may be situations such as network account arrearage, line fault, and the like, at which time DNS cannot be successfully accessed, and it may be determined that the fault cause is the first fault cause.
A4) In the event that a network signal is detected and access to a Domain Name System (DNS) is successful, it is determined that the cause of the failure is a second cause of failure.
Correspondingly, when it is determined that the DNS access can be successfully executed, it may be determined that the cloud server has a network failure, and at this time, it may be determined that the failure cause is the second failure cause.
D5) And sending information to the cloud server, and determining that the failure reason is a second failure reason in response to the fact that the returned information is not received within the time threshold range.
In the embodiment of the disclosure, information, such as empty data information, may be sent to the cloud server when it is determined that the network is disconnected, and if the return information of the cloud server is not received within the time threshold range, it may be determined that the cloud server fails, that is, the failure cause is the second failure cause, where the time threshold may be 5S, 10S, or other arbitrarily set time values, which is not specifically limited by the disclosure.
By the above mode, the reason that the network fails can be conveniently determined to be the local network fault or the cloud network fault, and based on the judgment, network state detection of different time strategies can be further executed until the fault disappears.
The method comprises the following steps that based on the determined fault reason, network state detection is executed according to a time strategy corresponding to the fault reason until the fault is eliminated:
B1) responding to the fault reason as a first fault reason, and detecting the network state according to a preset time interval until the first fault reason is eliminated;
in the embodiment of the disclosure, when it is determined that the local network is disconnected from the cloud server due to a fault, the network connection state may be detected according to a preset time interval, for example, whether a network port is powered on, whether a network signal exists, whether a DNS can be accessed, and the like may be detected. The preset time interval may be 1S or 5S, and may be specifically set according to a requirement.
B2) And responding to the second fault reason, determining the back-off time according to a preset algorithm, and detecting the network state based on the back-off time until the second fault reason is eliminated.
In addition, in the embodiment of the disclosure, the network state may be detected by using the back-off time obtained according to the preset algorithm when it is determined that the connection between the electronic device and the cloud server is disconnected due to the failure of the cloud server, and if the failure of the cloud server does not disappear, the back-off time is recalculated, and the network state is detected again until the failure disappears.
Fig. 2 shows a flowchart of step S30 in the method for reconnecting the cloud server according to the embodiment of the present disclosure. Wherein, the determining the back-off time according to the preset algorithm comprises:
s31: acquiring a random number and the number of times of currently detecting the network state;
s32: and determining the back-off time based on the random number and the times according to a preset algorithm. :
in the embodiment of the present disclosure, a random number may be obtained, and the number of times of currently performing network state detection may be determined, where a default initial value of the number of times may be zero, and when performing the calculation of the backoff time, 1 may be automatically added to the initial value as the number of times of currently detecting the network state, so that the backoff time from the next network state detection may be obtained according to a preset algorithm. For example, when the network state detection (calculation of the back-off time) is performed for the first time, 1 may be added to the initial value, that is, the current time value may be 1, if the network state detection for the first time determines that the second failure cause still exists in the network state, the calculation of the back-off time may be continuously performed, at this time, 1 may be added to the time value, that is, 2 is further obtained based on the preset calculation o, and the loop is performed until the network failure cause is eliminated.
The expression of the preset algorithm of the embodiment of the present disclosure may be t ═ min (M, rand ()% (5000+ failcnt 1000)). Wherein, t represents the back-off time, the unit is millisecond, min represents the minimum function, M is the set reference comparison value, rand ()% is the random function for generating random numbers, the value of the random function is an integer value between 1 and 5000+ failcnt 1000, the unit is millisecond, and failcnt represents the number of times of detecting the network state. Where M may be a set value, for example, embodiments of the present disclosure may set M to 5 × 60 × 1000 in milliseconds ms. As can be seen from the backoff time formula in the embodiment of the present disclosure, due to the introduction of the random variable, the backoff time of each device is different, and meanwhile, due to the introduction of the failcnt, as the number of failures increases, the backoff time range of the device also increases, but the maximum backoff time does not exceed 5 × 60 × 1000 milliseconds.
If the network state is detected when the back-off time is reached, and the second fault reason still exists, it indicates that the fault of the cloud server is not contacted, at this time, the failcnt can be added by 1, so that the back-off time is determined again, the update of the back-off time is completed, and the detection of the network state is executed again until the second fault reason is eliminated. In addition, if the detection of the network status is performed when the back-off time is reached, it is determined that the second cause of failure is eliminated, at which time it may be determined that the second cause of failure is eliminated. In this embodiment of the disclosure, when determining whether the second failure cause still exists, the information may be sent to the cloud server, and if return information corresponding to the sent information is detected within a time threshold, it may be determined that the second failure cause is eliminated, otherwise, it is determined that the second failure cause still exists.
In addition, in the embodiment of the present disclosure, in the case that it is determined that the second failure cause is eliminated, the value of the number of times failcnt of currently detecting the network state may be reset to the initial value (zero) so as not to affect the subsequent reconnection operation.
In the case of eliminating the cause of the failure, a reconnection request with the cloud server may be further performed. Fig. 3 is a flowchart illustrating step S40 in reconnecting a cloud server according to an embodiment of the present disclosure, where the sending a reconnection request to the cloud server to reestablish a network connection with the cloud server includes:
s41: sending a reconnection request to the cloud server based on a message queue telemetry transmission protocol;
s42: and responding to the connection notice of the cloud server, and reconnecting to establish network connection with the cloud server.
In some possible embodiments, the communication between the electronic device and the cloud server may be implemented based on a message queue telemetry transport MQTT protocol, and in the embodiments of the present disclosure, a reconnection request may be sent to the cloud server based on the MQTT protocol, and when receiving the reconnection request, the cloud server may identify an identity of the electronic device, such as information of a device name, a device model, and the like, and when determining that the electronic device is a stored communication device, send return information to the electronic device, where the return information is used to determine a connection state between the server and the electronic device. And the electronic equipment confirms that the reconnection operation with the cloud server is completed under the condition of receiving the return information.
The reconnection process of the embodiments of the present disclosure is illustrated below with reference to the drawings. Fig. 4 shows a schematic diagram of a process of reconnecting a cloud server according to an embodiment of the present disclosure. As shown in fig. 4, taking real-time communication between the electronic device and the cloud server through MQTT protocol as an example, when the electronic device finds that MQTT is offline (disconnected from the cloud server), the cause of the failure is determined. If the local network failure is determined (the local network fails), the network state detection can be executed circularly according to a preset time interval (such as 1s), if the network still fails in network connection, the failure cause detection can be executed again, and if the network still fails in network connection, the reconnection request is executed by using the MQTT protocol, and the reconnection with the cloud server is established. If the failure is determined not to be the cause of the local failure, namely the failure is the cloud end network failure, the current failure detection frequency can be determined, for example, failcnt plus 1 operation is executed, the back-off time is further determined by using a preset algorithm, the network state is detected under the condition that the back-off time is reached, the network failure detection is executed again if the connection failure condition still exists, if the network connection is successful, a reconnection request can be sent according to an MQTT protocol, the cloud end server is connected, and the frequency value is reset to zero after the connection is successful.
That is, the method can be used for solving the cloud performance problem caused by MQTT reconnection. The main process is as follows:
when the device finds that the MQTT is disconnected, the MQTT disconnection reason is firstly positioned and then is respectively processed.
If the local network has a problem and the MQTT is disconnected, the equipment continues to judge the state of the local network in the next second until the local network is recovered, and then initiates the MQTT connection again so as to recover the communication with the cloud as soon as possible.
If the cloud end is abnormal, the equipment can enter a random backoff state, backoff is carried out for a certain time, then the local network state is judged, and if the cloud end is still in an abnormal state at the moment, the random backoff is continued until the cloud end is recovered. The back-off time calculation formula is min (5 × 60 × 1000,1000+ rand () (5000+ failcnt × 1000)) milliseconds, and it can be seen from the back-off time formula that the back-off time of each device is different due to the introduction of the random variable, and meanwhile, due to the introduction of the failcnt, the back-off time range of the device is increased as the number of failures increases, but the maximum back-off time does not exceed 5 × 60 × 1000 milliseconds.
In summary, the conventional MQTT reconnection mechanism has less impact on the cloud when the number of devices is small, but causes great performance impact on the cloud when the number of devices is increased. In the embodiment of the disclosure, when it is detected that the device is disconnected from the cloud server, a failure reason of disconnection is determined first; based on the determined fault reason, the network state detection can be executed according to the time strategy corresponding to the fault reason until the fault is eliminated; and sending a reconnection request to the cloud server under the condition that the fault is eliminated, and reconnecting to establish network connection with the cloud server. The device can execute different time strategies according to the failure reason, detect the network state, and send a reconnection request to the server when the failure is detected to be eliminated. That is to say, this disclosed embodiment can carry out different time strategies according to the trouble reason, and different equipment can carry out the detection of network state according to the time value that the time strategy obtained to can make at least some equipment send the reconnection request to the cloud end server and can be staggered, reduce the pressure of cloud end server, this disclosed embodiment not only can resume the communication with the cloud end server as early as possible, can reduce the equipment quantity of connecting the cloud end simultaneously again, reduce the performance impact to the cloud end promptly.
It will be understood by those skilled in the art that in the method of the present invention, the order of writing the steps does not imply a strict order of execution and any limitations on the implementation, and the specific order of execution of the steps should be determined by their function and possible inherent logic.
It is understood that the above-mentioned method embodiments of the present disclosure can be combined with each other to form a combined embodiment without departing from the logic of the principle, which is limited by the space, and the detailed description of the present disclosure is omitted.
In addition, the present disclosure also provides a device, an electronic device, a computer-readable storage medium, and a program for reconnecting a cloud server, which can be used to implement any one of the methods for reconnecting a server provided by the present disclosure, and the descriptions of the corresponding technical solutions and the corresponding records in the method section are omitted for brevity.
Fig. 5 is a block diagram illustrating an apparatus for reconnecting a cloud server according to an embodiment of the present disclosure, and as shown in fig. 5, the apparatus for reconnecting a cloud server includes:
the determining module 10 is configured to determine a failure cause of disconnection in response to disconnection of a network connection with the cloud server;
a detection module 20, configured to perform network state detection according to a time policy corresponding to a failure cause until the failure is eliminated, based on the determined failure cause;
and the reconnection module 30 is configured to send a reconnection request to the cloud server, and reestablish a network connection with the cloud server.
In some possible embodiments, the determining the cause of the disconnection failure includes:
under the condition that the wired network is connected through the wired network and the wired network signal cannot be detected, determining that the fault reason is a first fault reason;
under the condition of wireless networking and no wireless network signal detection, determining that the fault reason is a first fault reason;
under the condition that a network signal is detected and a domain name system is accessed unsuccessfully, determining that the failure reason is a first failure reason;
and in the case that the network signal is detected and the access to the domain name system is successful, determining that the failure reason is a second failure reason.
In some possible embodiments, the performing, based on the determined failure cause and according to a time policy corresponding to the failure cause, the network state detection until the failure is resolved includes:
responding to the fault reason as a first fault reason, and detecting the network state according to a preset time interval until the first fault reason is eliminated;
and responding to the second fault reason, determining the back-off time according to a preset algorithm, and detecting the network state based on the back-off time until the second fault reason is eliminated.
In some possible embodiments, the determining the back-off time according to the preset algorithm includes:
acquiring a random number and the number of times of currently detecting the network state;
and determining the back-off time based on the random number and the times according to a preset algorithm.
In some possible embodiments, the expression of the preset algorithm is: t ═ min (M, rand ()% (5000+ failcnt × 1000));
where t denotes a back-off time, min denotes a minimum function, M is a set reference comparison value, rand ()% is a random function for generating random numbers, and failcnt denotes the number of times of detecting a network state.
In some possible embodiments, the first cause of failure comprises a failure with a local network,
the responding to the failure reason is the first failure reason, and detecting the network state according to the preset time interval until the first failure reason is eliminated comprises:
responding to the failure reason as a first failure reason, and detecting the connection state of the local network according to a preset interval;
in case of detecting the connection to the local network, the detection of the network status is stopped.
In some possible embodiments, the second cause of failure comprises a cloud server failure,
the detecting the network state based on the back-off time until the second fault reason is eliminated comprises:
detecting whether a second fault reason still exists or not under the condition that the back-off time is reached;
if so, updating the back-off time based on the preset algorithm;
and if not, determining to eliminate the second fault reason.
In some possible embodiments, the method further comprises:
resetting the number of times of detecting the network state to an initial value in a case where the second cause of failure is eliminated.
In some possible embodiments, the sending a reconnection request to the cloud server to reestablish a network connection with the cloud server includes:
sending a reconnection request to the cloud server based on a message queue telemetry transmission protocol;
and responding to the return information of the cloud server, and reconnecting to establish network connection with the cloud server.
In some embodiments, functions of or modules included in the apparatus provided in the embodiments of the present disclosure may be used to execute the method described in the above method embodiments, and specific implementation thereof may refer to the description of the above method embodiments, and for brevity, will not be described again here.
Embodiments of the present disclosure also provide a computer-readable storage medium having stored thereon computer program instructions, which when executed by a processor, implement the above-mentioned method. The computer readable storage medium may be a non-volatile computer readable storage medium.
An embodiment of the present disclosure further provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured as the above method.
The electronic device may be provided as a terminal, server, or other form of device.
Fig. 6 illustrates a block diagram of an electronic device 800 in accordance with an embodiment of the disclosure. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, or the like terminal.
Referring to fig. 6, electronic device 800 may include one or more of the following components: processing component 802, memory 804, power component 806, multimedia component 808, audio component 810, input/output (I/O) interface 812, sensor component 814, and communication component 816.
The processing component 802 generally controls overall operation of the electronic device 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 802 may include one or more processors 820 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 802 can include one or more modules that facilitate interaction between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operations at the electronic device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 804 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The power supply component 806 provides power to the various components of the electronic device 800. The power components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 800.
The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the electronic device 800 is in an operation mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a Microphone (MIC) configured to receive external audio signals when the electronic device 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 814 includes one or more sensors for providing various aspects of state assessment for the electronic device 800. For example, the sensor assembly 814 may detect an open/closed state of the electronic device 800, the relative positioning of components, such as a display and keypad of the electronic device 800, the sensor assembly 814 may also detect a change in the position of the electronic device 800 or a component of the electronic device 800, the presence or absence of user contact with the electronic device 800, orientation or acceleration/deceleration of the electronic device 800, and a change in the temperature of the electronic device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer-readable storage medium, such as the memory 804, is also provided that includes computer program instructions executable by the processor 820 of the electronic device 800 to perform the above-described methods.
Fig. 7 illustrates a block diagram of another electronic device 1900 in accordance with an embodiment of the disclosure. For example, the electronic device 1900 may be provided as a server. Referring to fig. 7, electronic device 1900 includes a processing component 1922 further including one or more processors and memory resources, represented by memory 1932, for storing instructions, e.g., applications, executable by processing component 1922. The application programs stored in memory 1932 may include one or more modules that each correspond to a set of instructions. Further, the processing component 1922 is configured to execute instructions to perform the above-described method.
The electronic device 1900 may also include a power component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input/output (I/O) interface 1958. The electronic device 1900 may operate based on an operating system stored in memory 1932, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, or the like.
In an exemplary embodiment, a non-transitory computer readable storage medium, such as the memory 1932, is also provided that includes computer program instructions executable by the processing component 1922 of the electronic device 1900 to perform the above-described methods.
The present disclosure may be systems, methods, and/or computer program products. The computer program product may include a computer-readable storage medium having computer-readable program instructions embodied thereon for causing a processor to implement various aspects of the present disclosure.
The computer readable storage medium may be a tangible device that can hold and store the instructions for use by the instruction execution device. The computer readable storage medium may be, for example, but not limited to, an electronic memory device, a magnetic memory device, an optical memory device, an electromagnetic memory device, a semiconductor memory device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a Static Random Access Memory (SRAM), a portable compact disc read-only memory (CD-ROM), a Digital Versatile Disc (DVD), a memory stick, a floppy disk, a mechanical coding device, such as punch cards or in-groove projection structures having instructions stored thereon, and any suitable combination of the foregoing. Computer-readable storage media as used herein is not to be construed as transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium (e.g., optical pulses through a fiber optic cable), or electrical signals transmitted through electrical wires.
The computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to a respective computing/processing device, or to an external computer or external storage device via a network, such as the internet, a local area network, a wide area network, and/or a wireless network. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. The network adapter card or network interface in each computing/processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in the respective computing/processing device.
The computer program instructions for carrying out operations of the present disclosure may be assembler instructions, Instruction Set Architecture (ISA) instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider). In some embodiments, the electronic circuitry that can execute the computer-readable program instructions implements aspects of the present disclosure by utilizing the state information of the computer-readable program instructions to personalize the electronic circuitry, such as a programmable logic circuit, a Field Programmable Gate Array (FPGA), or a Programmable Logic Array (PLA).
Various aspects of the present disclosure are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the disclosure. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer-readable program instructions.
These computer-readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer-readable program instructions may also be stored in a computer-readable storage medium that can direct a computer, programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer-readable medium storing the instructions comprises an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer, other programmable apparatus or other devices implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Having described embodiments of the present disclosure, the foregoing description is intended to be exemplary, not exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terms used herein were chosen in order to best explain the principles of the embodiments, the practical application, or technical improvements to the techniques in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.

Claims (10)

1. A method for reconnecting a cloud server, comprising:
responding to the disconnection of the network connection with the cloud server, and determining the fault reason of the disconnection;
based on the determined fault reason, executing network state detection according to a time strategy corresponding to the fault reason until the fault is eliminated;
and sending a reconnection request to the cloud server, and reestablishing the network connection with the cloud server.
2. The method of claim 1, wherein determining the cause of the disconnection failure comprises:
under the condition that the wired network is connected through the wired network and the wired network signal cannot be detected, determining that the fault reason is a first fault reason;
under the condition of wireless networking and no wireless network signal detection, determining that the fault reason is a first fault reason;
under the condition that a network signal is detected and a domain name system is accessed unsuccessfully, determining that the failure reason is a first failure reason;
and in the case that the network signal is detected and the access to the domain name system is successful, determining that the failure reason is a second failure reason.
3. The method of claim 1, wherein performing network status detection until failure resolution according to a time policy corresponding to a failure cause based on the determined failure cause comprises:
responding to the fault reason as a first fault reason, and detecting the network state according to a preset time interval until the first fault reason is eliminated;
and responding to the second fault reason, determining the back-off time according to a preset algorithm, and detecting the network state based on the back-off time until the second fault reason is eliminated.
4. The method of claim 3, wherein the determining the back-off time according to a predetermined algorithm comprises:
acquiring a random number and the number of times of currently detecting the network state;
and determining the back-off time based on the random number and the times according to a preset algorithm.
5. The method of claim 4, wherein the expression of the predetermined algorithm is: t ═ min (M, rand ()% (5000+ failcnt × 1000));
where t denotes a back-off time, min denotes a minimum function, M is a set reference comparison value, rand ()% is a random function for generating random numbers, and failcnt denotes the number of times of detecting a network state.
6. The method according to any of claims 3-5, wherein the first cause of failure comprises a failure with a local network,
the responding to the failure reason is the first failure reason, and detecting the network state according to the preset time interval until the first failure reason is eliminated comprises:
responding to the failure reason as a first failure reason, and detecting the connection state of the local network according to a preset interval;
in case of detecting the connection to the local network, the detection of the network status is stopped.
7. The method of any of claims 3-5, wherein the second cause of failure comprises a cloud server failure,
the detecting the network state based on the back-off time until the second fault reason is eliminated comprises:
detecting whether a second fault reason still exists or not under the condition that the back-off time is reached;
if so, updating the back-off time based on the preset algorithm;
and if not, determining to eliminate the second fault reason.
8. The method according to claim 4 or 5, characterized in that the method further comprises:
resetting the number of times of detecting the network state to an initial value in a case where the second cause of failure is eliminated.
9. The method of claim 1, wherein sending a reconnect request to the cloud server to reestablish the network connection with the cloud server comprises:
sending a reconnection request to the cloud server based on a message queue telemetry transmission protocol;
and responding to the return information of the cloud server, and reconnecting to establish network connection with the cloud server.
10. An electronic device, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to invoke the memory-stored instructions to perform the method of any of claims 1-9.
CN202010054947.6A 2020-01-17 2020-01-17 Method for reconnecting cloud server and electronic equipment Active CN111262941B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202010054947.6A CN111262941B (en) 2020-01-17 2020-01-17 Method for reconnecting cloud server and electronic equipment
PCT/CN2020/141613 WO2021143533A1 (en) 2020-01-17 2020-12-30 Method for reconnecting cloud server, and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010054947.6A CN111262941B (en) 2020-01-17 2020-01-17 Method for reconnecting cloud server and electronic equipment

Publications (2)

Publication Number Publication Date
CN111262941A true CN111262941A (en) 2020-06-09
CN111262941B CN111262941B (en) 2021-08-20

Family

ID=70954209

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010054947.6A Active CN111262941B (en) 2020-01-17 2020-01-17 Method for reconnecting cloud server and electronic equipment

Country Status (2)

Country Link
CN (1) CN111262941B (en)
WO (1) WO2021143533A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021143533A1 (en) * 2020-01-17 2021-07-22 杭州涂鸦信息技术有限公司 Method for reconnecting cloud server, and electronic device
CN114710569A (en) * 2022-03-11 2022-07-05 珠海派诺科技股份有限公司 Self-scaling TCP link maintenance method, system and storage medium

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2024505024A (en) 2021-01-26 2024-02-02 ベクトン ディキンソン フランス Tabs for packaging of multiple nests of plunger stoppers with guiding function, ensuring reliable positioning of the nests within the tabs

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101185294A (en) * 2005-05-26 2008-05-21 摩托罗拉公司 Method and apparatus for accessing a wireless communication network
CN104427633A (en) * 2013-08-23 2015-03-18 普天信息技术研究院有限公司 Control method for random access backoff
CN105099763A (en) * 2015-06-29 2015-11-25 小米科技有限责任公司 Method and device for reminding lost connection of equipment
CN105681203A (en) * 2016-01-14 2016-06-15 北京交通大学 Coping method for accidental invalidation of connection of spatial delay tolerant network
US9591083B1 (en) * 2005-11-23 2017-03-07 Avaya Inc. Method and apparatus providing connection recovery for a chat client
CN107547306A (en) * 2017-07-21 2018-01-05 新华三技术有限公司 A kind of data syn-chronization restoration methods, device and server
CN108430116A (en) * 2018-03-02 2018-08-21 杭州朗和科技有限公司 Suspension reconnection method, medium, device and computing device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2273763B1 (en) * 2009-06-26 2018-11-07 Orange System and method for detecting connection loss between a gateway and an application service
CN111262941B (en) * 2020-01-17 2021-08-20 杭州涂鸦信息技术有限公司 Method for reconnecting cloud server and electronic equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101185294A (en) * 2005-05-26 2008-05-21 摩托罗拉公司 Method and apparatus for accessing a wireless communication network
US9591083B1 (en) * 2005-11-23 2017-03-07 Avaya Inc. Method and apparatus providing connection recovery for a chat client
CN104427633A (en) * 2013-08-23 2015-03-18 普天信息技术研究院有限公司 Control method for random access backoff
CN105099763A (en) * 2015-06-29 2015-11-25 小米科技有限责任公司 Method and device for reminding lost connection of equipment
CN105681203A (en) * 2016-01-14 2016-06-15 北京交通大学 Coping method for accidental invalidation of connection of spatial delay tolerant network
CN107547306A (en) * 2017-07-21 2018-01-05 新华三技术有限公司 A kind of data syn-chronization restoration methods, device and server
CN108430116A (en) * 2018-03-02 2018-08-21 杭州朗和科技有限公司 Suspension reconnection method, medium, device and computing device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
周伟,谭小彬,季海波: "机器类型通信中随机接入信道的拥塞控制策略", 《计算机工程》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021143533A1 (en) * 2020-01-17 2021-07-22 杭州涂鸦信息技术有限公司 Method for reconnecting cloud server, and electronic device
CN114710569A (en) * 2022-03-11 2022-07-05 珠海派诺科技股份有限公司 Self-scaling TCP link maintenance method, system and storage medium

Also Published As

Publication number Publication date
WO2021143533A1 (en) 2021-07-22
CN111262941B (en) 2021-08-20

Similar Documents

Publication Publication Date Title
CN106961526B (en) Notification message display method and device and electronic equipment
RU2637470C2 (en) Method and device for detecting intelligent device
CN111262941B (en) Method for reconnecting cloud server and electronic equipment
WO2016192323A1 (en) Video communication method and device
CN112104807B (en) Control method, system and device for front camera
EP3136699A1 (en) Method and device for connecting external equipment
EP2938054B1 (en) Method, device and system for handling busy line
WO2017128718A1 (en) Method and device for acquiring terminal information
US20180091328A1 (en) Prompting method, prompting device and prompting system
CN106792937B (en) Method and device for processing call request
CN109922465B (en) Network configuration method and device
CN106658754B (en) Method and device for recovering network connection
CN105978663B (en) Data transmission method and device
CN108347718B (en) Method, device and storage medium for monitoring communication packet
US11510253B2 (en) Random access control method and random access control apparatus
CN110750226A (en) Central control equipment management method and device, computer equipment and storage medium
CN105227426B (en) Application interface switching method and device and terminal equipment
CN106507505B (en) Disconnection method and device for low-power-consumption Bluetooth connection
CN106789472B (en) Consumer electronic control CEC function detection method, device and system
CN112804769B (en) Method, device and storage medium for connecting network
CN107277422B (en) Video call method, device and system
WO2022120540A1 (en) Connection establishment method and apparatus
CN108551459B (en) Method and device for communication between devices and readable storage medium
CN108923988B (en) Equipment grouping method and device
CN111343272B (en) Cross-node request retry method of star network architecture and electronic equipment

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