Broken line reconnection method of intelligent embedded device remote management system
By combining heartbeat detection, TCP connection status check, Wi-Fi signal strength monitoring and traffic analysis, intelligent selection of disconnection and reconnection strategies has solved the shortcomings of the existing technology interruption problem, and achieved rapid and intelligent connection recovery and improved user experience.
Patent Information
- Application Number
- CN202510071520.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-16
- Publication Date
- 2025-04-29
AI Technical Summary
In the process of remote configuration, the existing technology lacks an intelligent reconnection strategy and an effective IP address change processing mechanism during remote configuration, resulting in slow recovery of connections and poor user experience.
The disconnection detection and reconnection strategy selection is adopted in a combination of various means, including heartbeat detection, TCP connection status check, Wi-Fi signal strength monitoring and traffic analysis. Differentiate different types of disconnection conditions and select suitable reconnection methods, such as fast reconnection strategy, exponential backoff algorithm and connection using a new IP address.
It significantly improves the disconnection and reconnection mechanism when remotely configuring the device, quickly and intelligently restores connections, improves the robustness and user experience of the system, ensures that connections can be quickly restored and better user feedback can be provided in complex network environments.
Smart Images

Figure CN119907145A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of embedded systems and network communication technology, and specifically relates to a disconnection and reconnection method for a remote management system of an intelligent embedded device. Background Art
[0002] With the widespread application of the Internet of Things (IoT) and smart home devices, users have a growing demand for remote management and configuration of these devices. Traditional remote configuration methods usually rely on specialized client software, which not only increases the complexity of user operations, but also significantly increases development costs. Users need to install and familiarize themselves with different client applications, which is particularly inconvenient for non-technical personnel. Among them, traditional remote configuration methods are difficult to quickly and intelligently restore connections when dealing with network instability or user mobility, resulting in a poor user experience. Existing technologies also have deficiencies in disconnection and reconnection mechanisms, such as the single heartbeat detection mechanism is not flexible enough, lacks an intelligent reconnection strategy, fails to effectively handle IP address changes, lacks real-time user feedback, and does not fully consider the user experience during reconnection. Summary of the invention
[0003] The present application provides a disconnection and reconnection method for a remote management system of an intelligent embedded device to solve the disconnection problem caused by network instability or user movement during the remote configuration process in the prior art. The traditional method lacks an intelligent reconnection strategy and an effective IP address change processing mechanism, resulting in slow connection recovery and poor user experience.
[0004] The technical solution adopted in this application is:
[0005] The present application embodiment provides a disconnection reconnection method for a remote management system of an intelligent embedded device, comprising:
[0006] Perform heartbeat detection on the client and device according to the preset period, and check the TCP connection status to determine whether there is a disconnection;
[0007] Classify the disconnection situations into WiFi signal problems, IP address changes, and device restarts or network configuration changes;
[0008] Select different reconnection methods according to different disconnection situations, and the reconnection methods include: fast reconnection strategy, exponential backoff algorithm and connecting using a new IP address;
[0009] Among them, the fast reconnection strategy is used to solve the WiFi signal problem, the exponential backoff algorithm is used to solve the device restart or network configuration change, and the use of a new IP address for connection is used to solve the IP address change.
[0010] According to an embodiment of the present application, the heartbeat detection is performed on the client and the device according to a preset period, and the connection status of TCP is checked to determine whether there is a disconnection, specifically:
[0011] Perform the heartbeat detection on the client and the device according to a preset period. If the heartbeat detection fails three times in a row, it is determined to be a preliminary disconnection;
[0012] The TCP connection status is checked, and if the connection status is abnormal, it is determined that the connection is disconnected.
[0013] According to an embodiment of the present application, the disconnection situation is divided into WiFi signal problem, IP address change and device restart or network configuration change, specifically:
[0014] Use the connection parameters of the last successful connection to try to reconnect. If the reconnection fails, check the WiFi signal strength and monitor the local and remote IP addresses;
[0015] When the WiFi signal strength is lower than a preset threshold, it is determined to be a WiFi signal problem;
[0016] When the IP address changes, it is determined that the IP address has changed;
[0017] If the WiFi signal strength is higher than the preset threshold and the IP address has not changed, a multi-path reconnection attempt is performed;
[0018] When the multipath reconnection attempt fails, it is determined that the device is restarted or the network configuration is changed.
[0019] According to an embodiment of the present application, the fast reconnection strategy is specifically:
[0020] Use the last successful connection parameters to quickly reconnect and shorten the reconnection interval;
[0021] Temporarily increase the TCP window size and shorten the interval for sending TCP keepalive detection packets;
[0022] Enable TCP's fast recovery algorithm and fast retransmit algorithm.
[0023] According to an embodiment of the present application, the fast retransmission algorithm is specifically:
[0024] When a receiver receives an out-of-order data segment, the receiver sends a duplicate cumulative acknowledgment;
[0025] If the sender receives three repeated cumulative acknowledgments, that is, the cumulative acknowledgments of the same sequence number appear four times, the lost data segment is immediately retransmitted without waiting for the retransmission timer to expire;
[0026] The fast recovery algorithm is specifically: after detecting the lost data segment, the congestion window is not reduced to the initial size, but it is halved and new data is continued to be sent;
[0027] Whenever a new cumulative confirmation is received, the congestion window increases by a maximum segment size until it reaches the size before the data segment is lost;
[0028] The slow start threshold is set to half of the congestion window.
[0029] According to an embodiment of the present application, the exponential backoff algorithm is specifically:
[0030] Initial reconnection interval to try to restore the connection;
[0031] After each reconnection failure, the reconnection interval increases exponentially until it reaches the maximum value;
[0032] Introduce a random factor so that the actual waiting time for each reconnection is different;
[0033] Set a maximum number of reconnection times. If the maximum number of reconnection times is exceeded and the connection fails, the system enters a waiting period or notifies the user for manual intervention.
[0034] According to an embodiment of the present application, the method of connecting using a new IP address includes:
[0035] Use the newly obtained IP address to establish a connection and minimize the reconnection interval;
[0036] If the new IP address fails to connect, try other available IP addresses in turn;
[0037] For devices that support dual network cards or multiple WAN ports, it will automatically switch to the backup network interface and continue to try to connect;
[0038] Switch to read-only mode, allowing users to view but not modify the configuration;
[0039] Prompt the user through the browser or application interface that the user is currently in the read-only mode, and explain the reason and the estimated recovery time;
[0040] When the network returns to normal, an asynchronous request is initiated to synchronize the latest configuration status.
[0041] A second aspect of the present application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and wherein the processor implements the steps of a method when executing the computer program.
[0042] The third aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the method when executed by a processor.
[0043] The fourth aspect of the present application provides a computer program product comprising instructions, which, when executed on a device, enables the device to execute the steps in the implementation method.
[0044] Due to the adoption of the above technical solution, the beneficial effects achieved by this application are as follows:
[0045] This application significantly improves the disconnection and reconnection mechanism when remotely configuring devices by introducing private protocols and proxy programs, and solves the problem of connection interruption caused by network instability or user movement in the prior art. First, the system adopts a combination of multiple means, such as heartbeat detection, TCP connection status check, Wi-Fi signal strength monitoring and traffic analysis, to more accurately determine the cause of the disconnection and distinguish different disconnection situations (such as short-term Wi-Fi signal problems, device restarts or network configuration changes, and users moving to new environmental networks). For different types of disconnection reasons, the system intelligently selects the most suitable reconnection strategy. For example, a fast reconnection strategy is used for short-term Wi-Fi signal problems, and an exponential backoff algorithm is used to gradually increase the reconnection interval for device restarts or network configuration changes. In addition, when the user moves to a new environmental network, the system can monitor the changes in local and remote IP addresses in real time, and give priority to trying to use the newly acquired IP address to establish a connection, thereby greatly shortening the reconnection time and improving the robustness of the system and user experience.
[0046] Through these improvements, the present invention not only ensures that connections can be quickly and intelligently restored in various complex network environments, but also provides a better user feedback mechanism. During the disconnection and reconnection process, the system will notify the user of the current status in real time and provide clear operation suggestions, so that the user can understand and take appropriate actions to solve the problem in time. At the same time, during the reconnection period, the system will automatically switch to read-only mode, allowing users to view but not modify the configuration, avoiding misoperation and ensuring data consistency and security. This intelligent disconnection and reconnection mechanism not only enhances the stability and reliability of the system, but also simplifies the user's operation process, providing users with a more stable and reliable remote management experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0048] Figure 1A flowchart of a disconnection and reconnection method for a remote management system of an intelligent embedded device provided in an embodiment of the present application;
[0049] Figure 2 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0050] Reference numerals:
[0051] 810, processor; 820, communication interface; 830, memory; 840, communication bus. DETAILED DESCRIPTION
[0052] In order to more clearly illustrate the overall concept of the present application, a detailed description is given below in an illustrative manner in conjunction with the accompanying drawings.
[0053] In the following description, many specific details are set forth to facilitate a full understanding of the present application. However, the present application may also be implemented in other ways different from those described herein. Therefore, the protection scope of the present application is not limited by the specific embodiments disclosed below. It should be noted that the embodiments of the present application and the features in each embodiment may be combined with each other without conflict.
[0054] In the present application, unless otherwise clearly specified and limited, a first feature "above" or "below" a second feature may be that the first and second features are in direct contact, or the first and second features are in indirect contact through an intermediate medium. In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in an appropriate manner in any one or more embodiments or examples.
[0055] like Figure 1 As shown, a disconnection reconnection method for a remote management system of an intelligent embedded device includes:
[0056] Perform heartbeat detection on the client and device according to the preset period, and check the TCP connection status to determine whether there is a disconnection.
[0057] Specifically, the system sets timers on the client and device respectively, automatically sends heartbeat packets (HEARTBEAT_REQUEST) at preset time intervals (e.g., every 5 seconds), and sets a response timeout (e.g., 2 seconds). Each time the timer is triggered, the client and device will send a heartbeat request packet to each other, and expect to receive the heartbeat response packet (HEARTBEAT_RESPONSE) of the other party within the specified time. If no response is received after the response timeout, a failure is recorded. When the heartbeat response is not received for multiple consecutive times (e.g., 3 times), the system formally determines that the connection is disconnected. In addition, in order to further confirm the disconnection, the system not only relies on heartbeat detection, but also enables the TCP keep-alive option (SO_KEEPALIVE), and checks the TCP connection status by sending detection packets regularly to prevent the connection that has been inactive for a long time from being closed by mistake. At the same time, the system monitors the Wi-Fi signal strength and traffic analysis in real time. If it is found that the Wi-Fi signal strength is lower than the set threshold (e.g., -70dBm) or there is no data transmission for a long time (e.g., 60 seconds), the disconnection detection process is triggered to further confirm whether it is really disconnected. This combination of multiple means can more accurately determine the cause of disconnection and distinguish different disconnection situations, such as short-term Wi-Fi signal problems, device restarts or network configuration changes, users moving to a new environment network, etc., thereby providing a reliable basis for subsequent intelligent reconnection strategies.
[0058] For example, the system sets a timer, such as triggering a heartbeat detection process every 5 seconds. During this period, the PC client and the device send heartbeat packets (HEARTBEAT_REQUEST) respectively, and set a response timeout of 2 seconds. Each time the timer is triggered, the PC client sends a heartbeat request to the device through the private protocol data channel, and the device also sends a heartbeat request to the PC client. If either party does not receive the heartbeat response from the other party within 2 seconds, a failure is recorded. When three consecutive heartbeat detections fail, the system formally determines that the connection is disconnected and starts the disconnection processing process. In addition, the system also enables the TCP keep-alive option (SO_KEEPALIVE) to periodically send detection packets to check the TCP connection status to ensure an additional layer of protection in addition to the application layer heartbeat packets. For example, if the network is unstable, although the application layer heartbeat packets may be lost, the TCP keep-alive mechanism can still detect connection anomalies in time, thereby triggering a reconnection attempt earlier. Once a disconnection is detected, the system immediately uses the last successful connection parameters for a fast reconnection attempt, minimizing the reconnection interval to 0.5 seconds to restore the connection as soon as possible. At the same time, the system monitors the changes of local and remote IP addresses in real time. Once the IP address change is detected, the reconnection process is immediately triggered, and the newly acquired IP address is used to establish the connection first, ensuring that normal communication can be quickly restored when the network environment changes. During the whole process, the system will also notify the user of the current status in real time through the browser or application interface, and provide clear operation suggestions, such as checking the network connection or waiting for a while to try again, to improve the user experience.
[0059] Furthermore, an intelligent prediction mechanism can be introduced to use machine learning algorithms to analyze historical network behavior data, predict potential disconnection risks, and take preventive measures in advance. For example, by collecting and analyzing multi-dimensional data such as users' daily usage patterns, network environment change trends, and device performance indicators, a prediction model can be built to evaluate the stability of the current network connection in real time. When the model predicts that a disconnection may occur in the short term in the future, the system can automatically adjust key parameters, such as increasing the TCP window size, optimizing routing selection, or temporarily increasing the heartbeat packet frequency, thereby pre-enhancing the connection quality and reducing the probability of actual disconnection. In addition, the system can also integrate adaptive bandwidth management functions to dynamically adjust the data transmission rate when poor network conditions are detected, giving priority to ensuring the smooth transmission of important data packets, while reducing the data traffic of non-critical services to ensure the availability of basic services during network fluctuations. To further improve the user experience, the system can proactively notify users before predicting an impending disconnection and provide temporary solution suggestions, such as switching to a more stable network environment or suspending non-essential background tasks, to minimize the impact of disconnection on user operations. Ultimately, through this forward-looking management and intelligent response, the system can not only respond more effectively to potential disconnection problems, but also significantly improve the stability and reliability of the overall network connection.
[0060] Categorize the disconnections into WiFi signal issues, IP address changes, and device reboots or network configuration changes.
[0061] Specifically, the disconnection situations are divided into Wi-Fi signal problems, IP address changes, and device restarts or network configuration changes, aiming to improve the system's ability to identify and respond to different disconnection reasons through refined classification. For Wi-Fi signal problems, the system detects short-term signal instability by real-time monitoring of Wi-Fi signal strength (such as less than -70dBm), and immediately initiates a quick reconnection attempt, minimizing the reconnection interval to 0.5 seconds to restore the connection as soon as possible, while combining traffic analysis to ensure that long periods of inactivity are not misjudged as disconnections. For IP address changes, the system monitors changes in local and remote IP addresses in real time. Once a change is detected, the reconnection process is immediately triggered and the newly acquired IP address is used to establish a connection first, thereby greatly shortening the reconnection time caused by changes in the network environment. In the case of device restart or network configuration change, the system uses an exponential backoff algorithm to gradually increase the reconnection interval, starting from a shorter initial reconnection interval (e.g. 1 second), doubling it after each reconnection failure until it reaches the maximum value (e.g. 60 seconds), and introducing a random factor (e.g. ±1 second) after each reconnection failure to prevent multiple clients from initiating reconnection requests at the same time, causing server load peaks. In addition, when the system detects a device restart or network configuration change, it caches the latest configuration status, and automatically initiates an asynchronous request to synchronize the latest configuration status after the network returns to normal to ensure data consistency. Through this classification process, the system can more intelligently select the most suitable reconnection strategy, significantly improving the robustness and user experience in complex environments such as network instability or user mobility.
[0062] For example, when a user moves from one room to another in a home environment, the Wi-Fi signal may be temporarily weakened or lost, resulting in continuous failure of heartbeat detection and abnormal TCP connection status. At this time, the system monitors the Wi-Fi signal strength in real time (such as below -70dBm) to determine that it is a temporary Wi-Fi signal problem and immediately initiates a fast reconnection mechanism, minimizing the reconnection interval to 0.5 seconds to restore the connection as soon as possible. On the other hand, when a user switches a device from one Wi-Fi network to another, the device obtains a new IP address. The system monitors the changes in local and remote IP addresses in real time. Once an IP address change is detected, the reconnection process is immediately triggered, and the newly acquired IP address is used to establish a connection first, which greatly shortens the reconnection time; finally, when the device is restarted or the user manually changes the network configuration (such as changing the router or adjusting the network settings), the system not only relies on heartbeat detection and TCP connection status check, but also combines traffic analysis to confirm that there has been no data transmission for a long time, triggering the exponential backoff algorithm to gradually increase the reconnection interval to avoid frequent reconnections from occupying too many resources. At the same time, detailed user feedback is provided to inform users of the current reconnection attempts and their progress, ensuring that users understand the current status and take appropriate actions. Through these specific classification processes, the system can respond to different types of disconnection situations more intelligently, significantly improving the speed and success rate of connection recovery.
[0063] Furthermore, a multi-dimensional environmental perception and intelligent classification mechanism can be introduced to achieve more accurate judgment and response to the cause of disconnection by integrating multiple sensor data and context information. For example, the system can integrate ambient light sensors and geographic location information, and combine the user's mobility pattern (such as through mobile phone GPS or Wi-Fi positioning) to intelligently identify whether the user has moved from one network environment to another, thereby optimizing the processing strategy for IP address changes. For Wi-Fi signal problems, in addition to the existing signal strength monitoring, channel quality index (CQI) analysis can be introduced to dynamically evaluate the quality of the current Wi-Fi channel, predict possible interference sources, and automatically switch to a better channel or frequency to improve connection stability. When a device restart or network configuration change is detected, the system can analyze historical logs through machine learning algorithms, identify common configuration change patterns, and provide users with optimization suggestions or automatically adjust configuration parameters in advance to reduce the risk of disconnection caused by improper configuration. In addition, the system can also establish a cloud-based knowledge base to collect and share the best practices of different device models after network configuration changes, helping users quickly find suitable solutions. In order to enhance the user experience, the system can automatically generate a detailed disconnection report after each successful connection restoration, including the cause of the disconnection, measures taken and improvement suggestions for users to refer to and learn from, thereby improving users' trust in the system and satisfaction with its use. Ultimately, through this multi-level, intelligent disconnection classification and response mechanism, the system can not only more accurately identify and solve various types of disconnection problems, but also significantly improve the efficiency and reliability of overall network management.
[0064] Select different reconnection methods according to different disconnection situations, and the reconnection methods include: fast reconnection strategy, exponential backoff algorithm and connecting using a new IP address;
[0065] Among them, the fast reconnection strategy is used to solve the WiFi signal problem, the exponential backoff algorithm is used to solve the device restart or network configuration change, and the use of a new IP address for connection is used to solve the IP address change.
[0066] Specifically, when the system detects a Wi-Fi signal problem, such as signal strength below a threshold or poor channel quality index (CQI), it immediately initiates a fast reconnection strategy, minimizing the reconnection interval to 0.5 seconds and slightly increasing the waiting time after each failure to quickly restore the connection and reduce user waiting time. In the case of a device restart or network configuration change, the system uses an exponential backoff algorithm, setting a shorter interval (such as 1 second) for the first reconnection attempt, and then increasing exponentially after each reconnection failure (such as 2 seconds, 4 seconds, 8 seconds, etc.) until the maximum value (such as 60 seconds) is reached. This method can avoid frequent resource occupation in a short period of time, and prevent multiple clients from initiating reconnection requests at the same time, causing server load peaks. In addition, when an IP address change is detected, the system monitors the changes in the local and remote IP addresses in real time. Once the new IP address is confirmed to be valid, the newly obtained IP address is immediately used to establish a connection to ensure that communication can be quickly restored when the user moves to a new network environment. To further optimize these reconnection strategies, the system can also combine machine learning algorithms to analyze historical data, predict possible disconnection causes, and adjust parameter settings in advance. For example, it can optimize the reconnection algorithm for specific types of frequent disconnections, thereby improving the overall network connection stability and user experience. Ultimately, through this intelligent and differentiated reconnection mechanism, the system can not only more effectively deal with various complex disconnection situations, but also significantly improve the user's operational convenience and system reliability.
[0067] For example, in a smart home environment, when a user moves from one room to another, the Wi-Fi signal may temporarily weaken or even be lost, resulting in a disconnection with the smart bulb. At this point, the system detects that the Wi-Fi signal strength is below a threshold (such as -70dBm) and immediately initiates a fast reconnection strategy. This strategy minimizes the reconnection interval to 0.5 seconds and sends multiple heartbeat packets continuously to restore the connection as quickly as possible. At the same time, the system automatically switches to a better Wi-Fi channel through channel quality index (CQI) analysis to ensure signal stability. If the connection is successfully restored in a short period of time, the user can continue to control the bulb seamlessly without noticing any interruption.
[0068] On the other hand, when the user updates the firmware of the home gateway, causing the device to restart or the network configuration to change, the system detects that the TCP connection state is abnormal and does not receive the expected heartbeat response. At this time, the system starts the exponential backoff algorithm, and the first reconnection attempt interval is set to 1 second. After each failure, the reconnection interval is gradually increased to a maximum of 60 seconds. This strategy avoids frequent resource occupation during network instability, while providing enough time for the device to complete the restart process. During this period, the system will also notify the user of the current status in real time through the browser or application interface, and recommend waiting for a while before trying again. Once the device has restarted and resumed normal operation, the system can quickly restore the connection to ensure that the user can continue to operate in the shortest time.
[0069] Finally, suppose the user moves from the home Wi-Fi network to a public Wi-Fi environment, causing the IP address to change. The system monitors the changes in local and remote IP addresses in real time, and once an IP address change is detected, it immediately triggers the mechanism to connect using the new IP address. The system first attempts to establish a connection using the newly acquired IP address, minimizing the reconnection interval to 0.5 seconds, and combines multipath attempts (if there are multiple public IP addresses) and backup network interfaces (for devices that support dual network cards or multiple WAN ports). In addition, the system also enables the dynamic DNS (DDNS) function to ensure that the externally visible IP address is updated in a timely manner. When the connection is successfully established, the system will not only synchronize the latest configuration status, but also record the IP address change event and its processing results for subsequent analysis and improvement. To further improve the user experience, the system will switch itself to read-only mode during the reconnection process, allowing users to view but not modify the configuration, prevent misoperation, and ensure data consistency.
[0070] Furthermore, adaptive learning mechanisms and multi-path optimization technologies can be introduced to enhance the intelligence and flexibility of reconnection strategies. For example, in response to Wi-Fi signal problems, in addition to the existing fast reconnection strategy, the system can dynamically adjust transmission parameters by real-time monitoring of channel quality and interference levels, such as automatically switching to a better Wi-Fi frequency band (2.4GHz or 5GHz), or using the characteristics of the Mesh network to find the best relay node to ensure a stable connection even in a complex environment. For device restarts or network configuration changes, the exponential backoff algorithm can combine machine learning models to predict the time window for the next successful connection, and intelligently adjust the reconnection interval based on historical data and current network status to avoid unnecessary resource consumption and improve the first reconnection success rate. In addition, the system can also integrate pre-fetching technology to cache necessary authentication information and service configuration in advance when it detects that a device restart is about to occur, making the reconnection process after the restart faster and more seamless. For IP address changes, in addition to directly using the new IP address for connection, the system can introduce a multi-path attempt mechanism, and use multiple available IP addresses or backup network interfaces (such as dual network cards or multiple WAN ports) to initiate connection requests in parallel, thereby significantly shortening the reconnection time. To further enhance the user experience, the system can record detailed log information after each reconnection attempt, including the reason for the reconnection, the measures taken, and the results, and continuously optimize the reconnection strategy through big data analysis to form a closed loop of continuous improvement. In addition, the system can also provide user-defined options, allowing advanced users to adjust the reconnection parameters in specific scenarios according to their needs, such as setting the priority network interface or specifying the maximum number of reconnection attempts. Ultimately, through this multi-level, intelligent reconnection strategy design, the system can not only respond to various types of disconnection problems more accurately, but also significantly improve the reconnection efficiency and success rate, providing users with a more stable and reliable remote management experience.
[0071] According to an embodiment of the present application, the heartbeat detection is performed on the client and the device according to a preset period, and the connection status of TCP is checked to determine whether there is a disconnection, specifically:
[0072] Perform the heartbeat detection on the client and the device according to a preset period. If the heartbeat detection fails three times in a row, it is determined to be a preliminary disconnection;
[0073] The TCP connection status is checked, and if the connection status is abnormal, it is determined that the connection is disconnected.
[0074] Specifically, the client and the device are heartbeat checked according to a preset period, and the TCP connection status is checked to determine whether there is a disconnection. Specifically, the system sets a fixed time interval (for example, every 5 seconds), during which the client and the device will regularly send heartbeat packets (HEARTBEAT_REQUEST) to confirm whether the other party is online. Each heartbeat detection not only includes a simple request response mechanism, but also involves a series of verification steps, such as checking the integrity of the returned data, the consistency of the timestamp, etc., to ensure that the status of the two communicating parties is true and valid. If the heartbeat detection fails three times in a row, that is, the expected response is not received within three consecutive heartbeat cycles, the system determines that it is a preliminary disconnection and triggers further diagnostic procedures. The generation of a preliminary disconnection alarm means that there may be network instability or other potential problems, but the occurrence of a disconnection has not yet been fully confirmed. In order to more accurately determine the connection status, the system will then check the specific status of the TCP connection. By calling the API provided by the operating system (such as Windows' getsockopt or Linux's ioct l), the system can obtain various parameters of the current TCP connection, including but not limited to the sequence number, confirmation number, window size, etc., to evaluate the health of the connection. If these parameters show abnormalities, such as the connection entering an abnormal state such as FIN_WAIT, TIME_WAIT or CLOSE_WAIT, or a large number of retransmissions, packet loss, etc., the system will eventually determine that the connection is disconnected. In addition, the system will combine other auxiliary information, such as Wi-Fi signal strength, traffic analysis results, etc., to comprehensively judge the changes in the network environment, thereby improving the accuracy and reliability of disconnection detection. Once the connection is determined to be disconnected, the system will immediately start the corresponding recovery mechanism, such as fast reconnection attempts, exponential backoff algorithms, or re-establishing connections using new IP addresses, to ensure that normal communication is restored in the shortest time. At the same time, the system will record detailed log information, including the results of each heartbeat detection, changes in TCP connection status, and recovery measures taken, for subsequent analysis and optimization. This multi-level and multi-dimensional disconnection detection mechanism not only improves the robustness and stability of the system, but also provides users with a more reliable and efficient remote management experience.
[0075] According to an embodiment of the present application, the disconnection situation is divided into WiFi signal problem, IP address change and device restart or network configuration change, specifically:
[0076] Use the connection parameters of the last successful connection to try to reconnect. If the reconnection fails, check the WiFi signal strength and monitor the local and remote IP addresses;
[0077] When the WiFi signal strength is lower than a preset threshold, it is determined to be a WiFi signal problem;
[0078] When the IP address changes, it is determined that the IP address has changed;
[0079] If the WiFi signal strength is higher than the preset threshold and the IP address has not changed, a multi-path reconnection attempt is performed;
[0080] When the multipath reconnection attempt fails, it is determined that the device is restarted or the network configuration is changed.
[0081] Specifically, the disconnection situation is divided into Wi-Fi signal problems, IP address changes, and device restarts or network configuration changes, specifically: when the system detects a preliminary disconnection, it first uses the connection parameters of the last successful connection to try to reconnect. If the reconnection fails, a series of detailed diagnostic steps are initiated to accurately determine the specific cause of the disconnection. The first is to check the Wi-Fi signal strength and monitor local and remote IP addresses. The system obtains the current Wi-Fi signal strength in real time through the built-in Wi-Fi management API (such as Windows' WLAN API or Linux's nl80211 interface) and compares it with a preset threshold (for example, -70dBm). If the Wi-Fi signal strength is lower than the threshold, the system determines that it is a Wi-Fi signal problem and immediately adopts a corresponding fast reconnection strategy, such as automatically switching to a better Wi-Fi frequency band (2.4GHz or 5GHz), or using the Mesh network characteristics to find the best relay node to ensure a stable connection even in a complex environment.
[0082] At the same time, the system continuously monitors changes in local and remote IP addresses. Once an IP address change is detected, whether it is due to the user moving to a new network environment or the DHCP lease expiration, the system will immediately trigger the process for handling IP address changes. In this case, the system will give priority to trying to establish a connection using the newly acquired IP address to shorten the reconnection time and increase the success rate. In order to further enhance the robustness of the system, the system can also integrate a multi-path attempt mechanism, and use multiple available IP addresses or backup network interfaces (such as dual network cards or multiple WAN ports) to initiate connection requests in parallel, thereby significantly shortening the reconnection time.
[0083] If the Wi-Fi signal strength is higher than the preset threshold and the IP address has not changed, but the reconnection still fails, the system enters the multi-path reconnection attempt phase. During this process, the system will not only try different network paths, but also dynamically adjust transmission parameters, such as temporarily increasing the TCP window size, optimizing routing selection, etc., to ensure that the data packet can reach the target device smoothly. In addition, the system can enable the traffic analysis module to monitor the data flow on the communication link. If there is no data transmission for a period of time (for example, 60 seconds), it will trigger further disconnection detection process to avoid misjudgment.
[0084] When multiple paths attempt to reconnect and fail, the system ultimately determines that the device has restarted or the network configuration has changed. At this point, the system uses an exponential backoff algorithm to gradually increase the reconnection interval to prevent frequent retries in a short period of time from wasting resources. At the same time, the machine learning model is combined to predict the time window for the next successful connection, and the reconnection interval is intelligently adjusted based on historical data and the current network status to avoid unnecessary resource consumption and increase the success rate of the first reconnection. In addition, the system can integrate pre-fetching technology to cache necessary authentication information and service configurations in advance when it detects that a device restart is about to occur, making the reconnection process after the restart faster and more seamless. Ultimately, through this multi-level, intelligent disconnection classification and response mechanism, the system can not only more accurately identify and solve various types of disconnection problems, but also significantly improve the efficiency and reliability of overall network management, providing users with a more stable and reliable remote management experience.
[0085] According to an embodiment of the present application, the fast reconnection strategy is specifically:
[0086] Use the last successful connection parameters to quickly reconnect and shorten the reconnection interval;
[0087] Temporarily increase the TCP window size and shorten the interval for sending TCP keepalive detection packets;
[0088] Enable TCP's fast recovery algorithm and fast retransmit algorithm.
[0089] Specifically, the fast reconnection strategy is as follows: when the system detects a preliminary disconnection, it first uses the last successful connection parameters to attempt a fast reconnection, and speeds up the recovery by shortening the reconnection interval. In the event of an initial reconnection failure, the system immediately initiates a series of optimization measures to improve the success rate and efficiency of the reconnection. The first is to temporarily increase the TCP window size (Congestion Window, cwnd), which allows the sender to send more data segments at a time, thereby reducing the transmission interruption time caused by network delays or packet loss. By dynamically adjusting the TCP window size, the system can send more data in a short period of time, making full use of the available bandwidth, thereby accelerating the process of reestablishing the connection.
[0090] At the same time, the system shortens the interval for sending TCP keep-alive probes to ensure that it can detect whether the other end is still online more quickly. The traditional TCP keep-alive mechanism usually sets a longer time interval (such as 2 hours), but in the fast reconnection scenario, the system greatly shortens this interval to a few seconds or even shorter to confirm the connection status more quickly. This method not only improves the sensitivity of detection, but also can promptly detect and handle short-term network instability, avoiding unnecessary long waits.
[0091] To further enhance the robustness of the system, TCP's Fast Recovery and Fast Retransmit algorithms are enabled. The Fast Retransmit algorithm can retransmit the lost data segment immediately upon receiving three redundant ACKs (cumulative acknowledgments) without waiting for the retransmission timer to expire. This mechanism can significantly reduce retransmission delays, especially in network environments with high packet loss rates. After detecting the lost data segment, the Fast Recovery algorithm does not reduce the congestion window to its initial size, but instead cuts it in half and continues to send new data. Each time a new ACK is received, the congestion window increases by one MSS (maximum segment size) until it reaches the size before the lost data segment. This approach avoids the additional delay caused by the slow start phase, allowing the system to resume normal transmission rates in a shorter time.
[0092] In addition, the system can also combine other optimization measures, such as Selective Acknowledgment (SACK), which allows the receiver to inform the sender which data segments have been successfully received and which data segments have been lost. This allows the lost data segments to be retransmitted more accurately and reduces the amount of unnecessary retransmissions. At the same time, the system can further optimize transmission performance by enabling the Forward RTO-Recovery (F-RTO) mechanism to avoid unnecessary retransmissions in some cases. To ensure the effective implementation of these optimization measures, the system also provides a detailed logging function to monitor the results of each reconnection attempt and the specific measures taken in real time, which is convenient for subsequent analysis and improvement. Ultimately, through this series of fast reconnection strategies, the system can not only significantly shorten the reconnection time and improve the reconnection success rate, but also provide users with a more stable and reliable remote management experience.
[0093] According to an embodiment of the present application, the fast retransmission algorithm is specifically:
[0094] When a receiver receives an out-of-order data segment, the receiver sends a duplicate cumulative acknowledgment;
[0095] If the sender receives three repeated cumulative acknowledgments, that is, the cumulative acknowledgments of the same sequence number appear four times, the lost data segment is immediately retransmitted without waiting for the retransmission timer to expire;
[0096] The fast recovery algorithm is specifically: after detecting the lost data segment, the congestion window is not reduced to the initial size, but it is halved and new data is continued to be sent;
[0097] Whenever a new cumulative confirmation is received, the congestion window increases by a maximum segment size until it reaches the size before the data segment is lost;
[0098] The slow start threshold is set to half of the congestion window.
[0099] Specifically, the fast retransmission algorithm is as follows: when the receiver receives an out-of-order data segment, that is, the received data segment sequence number is not continuous, the receiver will send a repeated cumulative acknowledgment (Duplicate ACK, DUP-ACK for short). This cumulative acknowledgment not only informs the sender of the data segment that has been successfully received, but also implicitly informs the sender that a data segment has been lost. If the sender receives three repeated cumulative acknowledgments, that is, the cumulative acknowledgment of the same sequence number appears four times, the lost data segment is immediately retransmitted without waiting for the retransmission timer to expire. This method significantly reduces the transmission delay caused by the loss of a single data segment, especially in the case of high packet loss rate or unstable network. Through the fast retransmission mechanism, the system can restore the continuity of the data stream in a short time, avoiding unnecessary long waiting.
[0100] The fast recovery algorithm further optimizes this process. Specifically, after detecting the lost data segment, the system does not reduce the congestion window (cwnd) to its initial size, but cuts it in half and continues to send new data. Whenever a new cumulative confirmation is received, the congestion window increases by a maximum segment size (MSS) until it reaches the size before the lost data segment. This method avoids the additional delay caused by the slow start phase, allowing the system to restore the normal transmission rate in a shorter time. By gradually restoring the congestion window, the system can both ensure the speed of quickly restoring the connection and prevent the network from being congested again due to a sudden increase in a large amount of data.
[0101] In addition, in order to better control the growth rate and stability of the congestion window, the slow start threshold (Slow Start Threshold, ssthresh) is set to half of the congestion window. This means that when the congestion window exceeds the slow start threshold, the system enters a linear growth mode, increasing only one MSS at a time, rather than exponential growth. This approach can maintain sensitivity to network conditions while recovering quickly, avoiding new packet loss or network congestion caused by overly aggressive window growth. In this way, the system can ensure the rational use of network resources while maintaining efficient transmission, thereby improving overall communication efficiency.
[0102] In summary, the fast retransmission and fast recovery algorithms work together to ensure that lost data segments can be quickly identified and corrected when a temporary anomaly occurs in the network, and that fast and stable connection recovery is achieved by intelligently adjusting the congestion window. These mechanisms not only improve the robustness and responsiveness of the system, but also significantly improve the user experience, especially in complex and changing network environments, providing more stable and reliable communication guarantees. The system also records detailed log information, including the time of each retransmission, changes in the congestion window, and specific measures taken, to facilitate subsequent analysis and optimization, and ensure continuous improvement in long-term operation.
[0103] According to an embodiment of the present application, the exponential backoff algorithm is specifically:
[0104] Initial reconnection interval to try to restore the connection;
[0105] After each reconnection failure, the reconnection interval increases exponentially until it reaches the maximum value;
[0106] Introduce a random factor so that the actual waiting time for each reconnection is different;
[0107] Set a maximum number of reconnection times. If the maximum number of reconnection times is exceeded and the connection fails, the system enters a waiting period or notifies the user for manual intervention.
[0108] Specifically, the exponential backoff algorithm is as follows: when the system detects a preliminary disconnection, it first attempts to restore the connection with a shorter initial reconnection interval (e.g., 1 second). After each reconnection failure, the system gradually increases the reconnection interval in an exponential growth manner until it reaches a preset maximum value (e.g., 60 seconds). This exponential growth strategy can frequently attempt to connect in the early stages while avoiding long-term resource occupation, thereby finding the best time to reconnect under different network conditions. In this way, the system can quickly respond to short-term network fluctuations in a short period of time, and reduce unnecessary resource consumption in the event of a long disconnection.
[0109] To further improve the robustness of the system and user experience, the exponential backoff algorithm introduces a randomization factor so that the actual waiting time for each reconnection is slightly different. Specifically, each time a new reconnection interval is calculated, the system adds a small random time offset (such as ±1 second) based on the expected exponential growth. This randomization mechanism can effectively prevent multiple clients from initiating reconnection requests at the same time, avoiding server load peaks or network congestion due to synchronization effects. In addition, it also increases the flexibility and adaptability of the system, ensuring that a suitable reconnection window can be found even when network conditions are complex and changeable.
[0110] In addition to dynamically adjusting the reconnection interval, the system also sets a maximum number of reconnection attempts (for example, 10 times) to prevent infinite reconnection attempts. If this number of attempts is still unsuccessful, the system enters a longer waiting period or notifies the user for manual intervention. In this case, the system automatically switches to a more conservative reconnection strategy, such as trying to reconnect every few minutes to give the network enough time to return to normal. At the same time, the system reminds users to check the network connection status or take other necessary measures, such as restarting the device or contacting technical support, through a friendly user interface or push notifications. This approach not only improves the intelligence level of the system, but also significantly improves user satisfaction and trust.
[0111] In order to enhance the system's adaptive capabilities, the exponential backoff algorithm can also be combined with a real-time network status monitoring module to dynamically adjust parameter settings. For example, if the system detects that the current network environment has a high packet loss rate or delay, it may appropriately shorten the initial reconnection interval to respond more quickly to possible short-term disconnections; on the contrary, if the network condition is good but multiple reconnections still fail, the maximum reconnection interval may be extended to avoid unnecessary pressure on the network. In addition, the system can analyze historical data through machine learning models, predict potential disconnection patterns, and optimize reconnection strategies in advance, thereby further improving the success rate and efficiency of reconnection.
[0112] Ultimately, through this multi-level, intelligent exponential backoff algorithm design, the system can not only more effectively deal with various types of disconnection problems, but also significantly improve reconnection efficiency and success rate, providing users with a more stable and reliable remote management experience. The system will also record in detail the results of each reconnection attempt and the specific measures taken, including reconnection interval, actual waiting time, maximum number of reconnections, etc., to facilitate subsequent analysis and continuous improvement, to ensure performance optimization and service quality improvement in long-term operation.
[0113] According to an embodiment of the present application, the method of connecting using a new IP address includes:
[0114] Use the newly obtained IP address to establish a connection and minimize the reconnection interval;
[0115] If the new IP address fails to connect, try other available IP addresses in turn;
[0116] For devices that support dual network cards or multiple WAN ports, it will automatically switch to the backup network interface and continue to try to connect;
[0117] Switch to read-only mode, allowing users to view but not modify the configuration;
[0118] Prompt the user through the browser or application interface that the user is currently in the read-only mode, and explain the reason and the estimated recovery time;
[0119] When the network returns to normal, an asynchronous request is initiated to synchronize the latest configuration status.
[0120] Specifically, the use of a new IP address for connection is as follows: when the system detects a change in the IP address, it immediately attempts to establish a connection using the newly acquired IP address, and minimizes the reconnection interval (for example, 0.5 seconds) to restore the connection as soon as possible. If the new IP address connection fails, the system will try other available IP addresses in turn to ensure that the best connection path is found among multiple options. For devices that support dual network cards or multiple WAN ports, the system can automatically switch to the backup network interface to continue trying to connect, thereby greatly improving the success rate and efficiency of reconnection. This multi-path attempt mechanism not only shortens the reconnection time, but also enhances the robustness and adaptability of the system.
[0121] To ensure user experience and data consistency, the system will switch to read-only mode during reconnection, allowing users to view but not modify configurations to prevent data inconsistency caused by misoperation. At the same time, through the browser or application interface, the system will remind users in real time that they are currently in read-only mode, explain the reasons and estimated recovery time, and provide clear operational suggestions, so that users can understand the current status in a timely manner and take appropriate actions. This approach not only improves users' right to know and operational transparency, but also reduces unnecessary anxiety and confusion.
[0122] When the network returns to normal, the system will automatically initiate an asynchronous request to synchronize the latest configuration status to ensure the consistency and accuracy of all settings and data. This process includes pulling the latest configuration file from the server, updating the local cache, and adjusting the necessary parameter settings, so that the system can quickly recover to the state before the disconnection and continue to operate normally. In addition, the system will also record detailed log information, including the results of each reconnection attempt, the switched network interface, the synchronized configuration status, etc., to facilitate subsequent analysis and optimization. Ultimately, through this series of intelligent and efficient measures, the system can not only quickly and accurately respond to the challenges brought about by IP address changes, but also significantly improve the stability and reliability of remote management, providing users with a smoother and more reliable user experience.
[0123] The second aspect of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the disconnection reconnection method of the remote management system of the intelligent embedded device in any embodiment of the first aspect is implemented.
[0124] Figure 2 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 2As shown, the electronic device may include: a processor 810, a communication interface 820, a memory 830 and a communication bus 840, wherein the processor 810, the communication interface 820, and the memory 830 communicate with each other through the communication bus 840. The processor 810 may call the logic instructions in the memory 830 to execute the disconnection reconnection method of the remote management system of the intelligent embedded device in any embodiment of the first aspect above, and the method includes:
[0125] Perform heartbeat detection on the client and device according to the preset period, and check the TCP connection status to determine whether there is a disconnection;
[0126] Classify the disconnection situations into WiFi signal problems, IP address changes, and device restarts or network configuration changes;
[0127] Select different reconnection methods according to different disconnection situations, and the reconnection methods include: fast reconnection strategy, exponential backoff algorithm and connecting using a new IP address;
[0128] Among them, the fast reconnection strategy is used to solve the WiFi signal problem, the exponential backoff algorithm is used to solve the device restart or network configuration change, and the use of a new IP address for connection is used to solve the IP address change.
[0129] In addition, the logic instructions in the above-mentioned memory 830 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0130] On the other hand, the present invention further provides a computer program product, the computer program product includes a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, when the computer program is executed by a processor, the computer can execute the disconnection reconnection method of the intelligent embedded device remote management system provided by the above methods, the method includes:
[0131] Perform heartbeat detection on the client and device according to the preset period, and check the TCP connection status to determine whether there is a disconnection;
[0132] Classify the disconnection situations into WiFi signal problems, IP address changes, and device restarts or network configuration changes;
[0133] Select different reconnection methods according to different disconnection situations, and the reconnection methods include: fast reconnection strategy, exponential backoff algorithm and connecting using a new IP address;
[0134] Among them, the fast reconnection strategy is used to solve the WiFi signal problem, the exponential backoff algorithm is used to solve the device restart or network configuration change, and the use of a new IP address for connection is used to solve the IP address change.
[0135] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to execute the disconnection and reconnection method of the remote management system of the intelligent embedded device provided by the above methods, the method comprising:
[0136] Perform heartbeat detection on the client and device according to the preset period, and check the TCP connection status to determine whether there is a disconnection;
[0137] Classify the disconnection situations into WiFi signal problems, IP address changes, and device restarts or network configuration changes;
[0138] Select different reconnection methods according to different disconnection situations, and the reconnection methods include: fast reconnection strategy, exponential backoff algorithm and connecting using a new IP address;
[0139] Among them, the fast reconnection strategy is used to solve the WiFi signal problem, the exponential backoff algorithm is used to solve the device restart or network configuration change, and the use of a new IP address for connection is used to solve the IP address change.
[0140] Example 2
[0141] Assume that a user is connected to a smart home gateway via Wi-Fi at home. The gateway is used to manage and control various smart devices at home. The user remotely accesses the gateway's web interface through a browser for configuration and monitoring. One day, the user takes his laptop out and moves to a new public Wi-Fi network environment, causing the IP address to change and the Wi-Fi signal strength to be unstable, which triggers the system's disconnection and reconnection mechanism.
[0142] System architecture and components
[0143] PC client: includes a proxy program responsible for transparently transmitting data between the browser and the private protocol data channel.
[0144] Device side (smart home gateway): includes a web proxy program, which is responsible for transparently transmitting data between the private protocol data transmission channel and the device web service (port 80 or 443).
[0145] Private protocol data channel: responsible for establishing a secure communication channel between the PC client and the device, using SSL / TLS encryption technology to ensure the security of data transmission.
[0146] Disconnection detection and preliminary judgment
[0147] Heartbeat detection: The system is set to perform a heartbeat detection on the client and device every 5 seconds. Each detection not only sends a simple request response packet, but also verifies the integrity of the returned data and the consistency of the timestamp. If the heartbeat detection fails three times in a row, the system will determine that the connection is initially disconnected.
[0148] TCP connection status check: Get the status parameters of the current TCP connection by calling the API provided by the operating system (such as getsockopt in Windows or ioctl in Linux). If the connection enters an abnormal state (such as FIN_WAIT, TIME_WAIT, or CLOSE_WAIT), or there are a lot of retransmissions or packet loss, the system will eventually determine that the connection is disconnected.
[0149] Fast reconnection strategy
[0150] Initial reconnection attempt: The system first uses the last successful connection parameters for a quick reconnection attempt, minimizing the reconnection interval to 0.5 seconds.
[0151] Temporarily increase the TCP window size: To improve transmission efficiency, the system temporarily increases the TCP window size, allowing more data segments to be sent at one time and making full use of the available bandwidth.
[0152] Shorten the TCP keepalive detection packet sending interval: The traditional 2-hour keepalive detection packet sending interval is shortened to a few seconds to confirm the connection status more quickly.
[0153] Enable fast recovery and fast retransmit algorithms: When three duplicate cumulative acknowledgments are received, the lost data segment is retransmitted immediately; after the lost data segment is detected, the congestion window is halved and new data continues to be sent until the normal transmission rate is restored.
[0154] Intelligent classification and processing
[0155] Wi-Fi signal strength check: The system obtains the current Wi-Fi signal strength in real time through the built-in Wi-Fi management API. If the signal strength is lower than the preset threshold (for example, -70dBm), it is determined to be a Wi-Fi signal problem and the fast reconnection strategy is initiated.
[0156] IP address change monitoring: The system continuously monitors changes in local and remote IP addresses. Once an IP address change is detected, the system immediately attempts to establish a connection using the newly acquired IP address. For devices that support dual network cards or multiple WAN ports, it automatically switches to the backup network interface and continues to try to connect.
[0157] Multi-path reconnection attempt: If the Wi-Fi signal strength is higher than the preset threshold and the IP address has not changed, but the reconnection still fails, the system enters the multi-path reconnection attempt phase and dynamically adjusts the transmission parameters to ensure that the data packet reaches the target device smoothly.
[0158] Device restart or network configuration change: When multi-path reconnection attempts fail, the system determines that the device has restarted or the network configuration has changed, uses an exponential backoff algorithm to gradually increase the reconnection interval, and combines the machine learning model to predict the best connection time.
[0159] User experience optimization
[0160] Switch to read-only mode: During the reconnection period, the system switches to read-only mode, allowing users to view but not modify the configuration to prevent data inconsistency caused by misoperation.
[0161] User feedback mechanism: Through the browser or application interface, the system reminds users in real time that they are currently in read-only mode, explains the reasons and estimated recovery time, and provides clear operational suggestions.
[0162] Asynchronous synchronization of configuration status: When the network returns to normal, the system automatically initiates an asynchronous request to synchronize the latest configuration status to ensure the consistency and accuracy of all settings and data.
[0163] Actual execution process
[0164] User moves to a new environment network: The user takes his laptop out and connects to a new public Wi-Fi network, causing the IP address to change.
[0165] Disconnection detection: The system detects three consecutive heartbeat detection failures and confirms the connection is disconnected through TCP connection status check.
[0166] Fast reconnection attempt: The system first uses the last successful connection parameters to perform a fast reconnection attempt, minimizing the reconnection interval to 0.5 seconds.
[0167] Wi-Fi signal strength check: The system detects that the Wi-Fi signal strength is lower than the preset threshold, determines it as a Wi-Fi signal problem, and initiates a fast reconnection strategy.
[0168] IP address change monitoring: When the system detects a change in the IP address, it immediately attempts to establish a connection using the newly acquired IP address and successfully connects to the new network environment.
[0169] User experience optimization: During the reconnection period, the system switches to read-only mode, notifies the user of the current status through the browser interface, and explains the reason and estimated recovery time.
[0170] Asynchronous synchronization of configuration status: After the network returns to normal, the system automatically initiates an asynchronous request to synchronize the latest configuration status to ensure the consistency and accuracy of all settings and data.
[0171] Through this series of intelligent disconnection and reconnection mechanisms and configuration optimization measures, the system can not only respond to complex network changes quickly and accurately, but also significantly improve the user's remote management experience and provide more stable and reliable connections and services.
[0172] Anything not described in this application can be achieved by adopting or drawing on existing technologies.
[0173] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.
[0174] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A disconnection reconnection method for a remote management system of an intelligent embedded device, characterized in that: include: Perform heartbeat detection on the client and device according to the preset period, and check the TCP connection status to determine whether there is a disconnection; Classify the disconnection situations into WiFi signal problems, IP address changes, and device restarts or network configuration changes; Select different reconnection methods according to different disconnection situations, and the reconnection methods include: fast reconnection strategy, exponential backoff algorithm and connecting using a new IP address; Among them, the fast reconnection strategy is used to solve the WiFi signal problem, the exponential backoff algorithm is used to solve the device restart or network configuration change, and the use of a new IP address for connection is used to solve the IP address change.
2. The method according to claim 1, characterized in that The heartbeat detection is performed on the client and the device according to the preset period, and the TCP connection status is checked to determine whether there is a disconnection, specifically: Perform the heartbeat detection on the client and the device according to a preset period. If the heartbeat detection fails three times in a row, it is determined to be a preliminary disconnection; The TCP connection status is checked, and if the connection status is abnormal, it is determined that the connection is disconnected.
3. The method according to claim 1, characterized in that The disconnection situations are divided into WiFi signal problems, IP address changes, and device restarts or network configuration changes, specifically: Use the connection parameters of the last successful connection to try to reconnect. If the reconnection fails, check the WiFi signal strength and monitor the local and remote IP addresses; When the WiFi signal strength is lower than a preset threshold, it is determined to be a WiFi signal problem; When the IP address changes, it is determined that the IP address has changed; If the WiFi signal strength is higher than the preset threshold and the IP address has not changed, a multi-path reconnection attempt is performed; When the multipath reconnection attempt fails, it is determined that the device is restarted or the network configuration is changed.
4. The method according to claim 1, characterized in that The fast reconnection strategy is specifically: Use the last successful connection parameters to quickly reconnect and shorten the reconnection interval; Temporarily increase the TCP window size and shorten the interval for sending TCP keepalive detection packets; Enable TCP's fast recovery algorithm and fast retransmit algorithm.
5. The method according to claim 4, characterized in that The fast retransmission algorithm is specifically: When a receiver receives an out-of-order data segment, the receiver sends a duplicate cumulative acknowledgment; If the sender receives three repeated cumulative acknowledgments, that is, the cumulative acknowledgments of the same sequence number appear four times, the lost data segment is immediately retransmitted without waiting for the retransmission timer to expire; The fast recovery algorithm is specifically: after detecting the lost data segment, the congestion window is not reduced to the initial size, but it is halved and new data is continued to be sent; Whenever a new cumulative confirmation is received, the congestion window increases by a maximum segment size until it reaches the size before the data segment is lost; The slow start threshold is set to half of the congestion window.
6. The method according to claim 1, characterized in that The exponential backoff algorithm is specifically: Initial reconnection interval to try to restore the connection; After each reconnection failure, the reconnection interval increases exponentially until it reaches the maximum value; A random factor is introduced to make the actual waiting time of each reconnection different; Set a maximum number of reconnection times. If the maximum number of reconnection times is exceeded and the connection fails, the system enters a waiting period or notifies the user for manual intervention.
7. The method according to claim 1, characterized in that include: The connection using the new IP address is specifically as follows: Use the newly obtained IP address to establish a connection and minimize the reconnection interval; If the new IP address fails to connect, try other available IP addresses in turn; For devices that support dual network cards or multiple WAN ports, it will automatically switch to the backup network interface and continue to try to connect; Switch to read-only mode, allowing users to view but not modify the configuration; Prompt the user through the browser or application interface that the user is currently in the read-only mode, and explain the reason and the estimated recovery time; When the network returns to normal, an asynchronous request is initiated to synchronize the latest configuration status.
8. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer program product comprising instructions, which, when executed on a device, is characterized in that: The device is enabled to execute the steps in the method according to any one of claims 1 to 7.
Citation Information
Cited By
Method and system for identifying and recovering false offline of equipment under communication scene of Internet of Things
CN121077945A
A KVM communication link monitoring and breakpoint self-recovery reconnection method and system based on TCP / TLS encryption
CN122601445A