Network connection method and apparatus
By periodically reconnecting when the terminal device loses network connection and restarting after failure, and gradually increasing the reconnection interval, the power consumption problem caused by frequent reconnection of terminal devices is solved, and a low-power and long-lasting network connection method is achieved.
Patent Information
- Application Number
- PCT/CN2025/108454
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-07-29
- Filing Date
- 2025-07-14
- Publication Date
- 2026-02-05
AI Technical Summary
Terminal devices frequently attempt to reconnect to the network in situations with weak signal/no signal/no network, leading to increased power consumption, failing to meet low power consumption requirements, and affecting user experience.
When the network is disconnected, reconnect at preset time intervals. If the connection fails, determine whether the conditions for stopping reconnection are met. If they are met, restart the device and gradually increase the reconnection interval after restarting until the restart conditions are met, thereby reducing the number of reconnections.
By reducing the number of reconnections and power consumption, the usable time of terminal devices on a single charge is extended, ensuring low power consumption requirements and improving user experience.
Smart Images

Figure CN2025108454_05022026_PF_FP_ABST
Abstract
Description
Network connection method and apparatus
[0001] The present application claims priority to the Chinese patent application No. 202411026034.8, filed on July 29, 2024, and entitled "Network connection method and apparatus", the content of which is incorporated herein by reference in its entirety. TECHNICAL FIELD
[0002] The present application relates to the technical field of network communication, and in particular to a network connection method and apparatus. BACKGROUND
[0003] In today's intelligent era, various traditional products have entered the digital stage, and with the development of the network, terminal devices supporting the network are becoming more and more popular. For some battery-powered terminal devices, the requirement for low power consumption is relatively high, that is, the minimum power consumption of the device needs to be guaranteed in various scenarios.
[0004] However, in actual application, the terminal device may be in a weak signal / no signal / no network situation during the use of the network, which leads to the need for the terminal device to constantly attempt to reconnect the network, resulting in a large power consumption of the terminal device, thereby reducing the usable time of a single charge, failing to guarantee the low power consumption requirement, and affecting the user experience. SUMMARY
[0005] The present application provides a network connection method and apparatus to improve the usable time of a single charge of a terminal device, guarantee the low power consumption requirement of the terminal device, and improve the user experience.
[0006] In a first aspect, the present application provides a network connection method applied to a terminal device, wherein the terminal device connects to a network through an access network service device, and the method comprises:
[0007] In a case where it is determined that the connected network is disconnected, reconnecting the network service device according to a preset first time interval;
[0008] In a case where the reconnection with the network service device is not successful, determining whether a preset stop-reconnection condition is met at present;
[0009] In a case where it is determined that the stop-reconnection condition is met at present, performing a restart operation;
[0010] After the restart operation is completed, reconnecting the network service device according to a preset reconnection strategy, wherein the second time interval for reconnecting the network service device in the reconnection strategy is sequentially increased, and in a case where a preset network service device restart condition is met, the reconnection of the network service device is stopped.
[0011] With reference to the first aspect, in a first possible implementation manner of the first aspect, the network is a wireless network, and the reconnecting to the network service device according to the preset first time interval comprises:
[0012] scanning a plurality of wireless hotspots according to the first time interval;
[0013] obtaining a signal strength of each wireless hotspot;
[0014] determining a first threshold number of times of the wireless hotspot according to the signal strength of the wireless hotspot for each wireless hotspot, the first threshold number of times being proportional to the signal strength;
[0015] reconnecting to a network service device of each wireless hotspot according to the first threshold number of times of the corresponding wireless hotspot in a descending order of the signal strength of the scanned wireless hotspots, until a network service device is reconnected.
[0016] With reference to the first aspect, in a second possible implementation manner of the first aspect, the determining the first threshold number of times of the wireless hotspot according to the signal strength of the wireless hotspot comprises:
[0017] determining a target signal strength range to which the signal strength of the wireless hotspot belongs from a plurality of preset signal strength ranges;
[0018] determining a first threshold number of times corresponding to the target signal strength range from a preset corresponding relationship between the signal strength range and the first threshold number of times.
[0019] With reference to the first aspect, in a third possible implementation manner of the first aspect, the reconnecting to the network service device of each wireless hotspot according to the first threshold number of times of the corresponding wireless hotspot comprises:
[0020] counting a first reconnection number of times of reconnecting to the network service device of the wireless hotspot for a current wireless hotspot to be connected;
[0021] reconnecting to a network service device of a next wireless hotspot in a case where the first reconnection number of times is greater than the first threshold number of times.
[0022] With reference to the first aspect, in a fourth possible implementation manner of the first aspect, the network is a wired network, and the reconnecting to the network service device according to the preset first time interval comprises:
[0023] initiating a reconnection request to a network service device connected last time according to the first time interval;
[0024] In a case where the number of reconnection requests initiated reaches a preset number threshold, the reconnection request is initiated to other network service devices until a network service device is reconnected, or a preset stop reconnection condition is reached; wherein the network service device that is reconnected last time and the other network service devices are any network service device in a same network device cluster.
[0025] With reference to the first aspect, in a fifth possible implementation manner of the first aspect, the determining whether the preset stop reconnection condition is met currently comprises:
[0026] obtaining a number of reconnections currently initiated;
[0027] determining whether the number of reconnections is greater than a preset second number threshold;
[0028] in a case where it is determined that the number of reconnections is greater than the second number threshold, determining that the preset stop reconnection condition is met currently.
[0029] With reference to the first aspect, in a sixth possible implementation manner of the first aspect, the determining whether the preset stop reconnection condition is met currently comprises:
[0030] obtaining a total reconnection time length of reconnections initiated to the network service device;
[0031] determining whether the total reconnection time length is greater than or equal to a preset time length threshold;
[0032] in a case where it is determined that the total reconnection time length is greater than or equal to the time length threshold, determining that the preset stop reconnection condition is met currently.
[0033] With reference to the first aspect, in a seventh possible implementation manner of the first aspect, the performing a restart operation comprises:
[0034] obtaining a current value of a preset restart flag bit;
[0035] in a case where it is determined that the current value is a first preset value, performing a restart operation;
[0036] the method further comprises:
[0037] updating the current value of the restart flag bit from the first preset value to a second preset value, the second preset value being used to represent that the terminal device has been restarted currently.
[0038] With reference to the first aspect, in an eighth possible implementation manner of the first aspect, the reconnection to the network service device according to the preset reconnection strategy comprises:
[0039] obtaining a total number of reconnections from disconnection from the network to the current initiation;
[0040] determine a second time interval according to the total number of reconnections;
[0041] reconnect the network service device after reaching the second time interval;
[0042] determine whether the network service device is successfully connected, and determine whether the network service device restart condition is met at present;
[0043] if it is determined that the network service device is not successfully connected and the network service device restart condition is not met at present, return to the step of obtaining the total number of reconnections initiated from the network disconnection to the present;
[0044] if it is determined that the network service device is not successfully connected and it is determined that the network service device restart condition is met at present, output prompt information for prompting the network service device to perform a restart operation to the network service device, so that the network service device performs the restart operation.
[0045] With reference to the first aspect, in a ninth possible implementation manner of the first aspect, the terminal device comprises a counter, and the counter is configured to count a total number of reconnection operations initiated by the terminal device in a process of determining that the network disconnection starts to the present.
[0046] the obtaining of the total number of reconnections initiated from the network disconnection to the present comprises:
[0047] obtaining a count value counted by the counter at present;
[0048] determining the count value as the total number of reconnections.
[0049] With reference to the first aspect, in a tenth possible implementation manner of the first aspect, the determination of the second time interval according to the total number of reconnections comprises:
[0050] in a case where the network is a wireless network, obtaining a reconnection number difference value by subtracting the total number of reconnections from the second number threshold; performing a first preset operation on the reconnection number difference value and a first preset parameter to obtain the second time interval;
[0051] in a case where the network is a wired network, performing a second preset operation on the total number of reconnections and a second preset parameter to obtain the second time interval.
[0052] With reference to the first aspect, in an eleventh possible implementation manner of the first aspect, the first preset parameter is a first adjustment time parameter preset in advance, and the obtaining of the second time interval by performing the first preset operation on the reconnection number difference value and the first preset parameter comprises:
[0053] multiplying the difference value of the number of reconnections and the first adjustment time parameter to obtain the second time interval.
[0054] With reference to the first aspect, in a twelfth possible implementation manner of the first aspect, the second preset parameter is a preset second adjustment time parameter, and the second preset operation of the total number of reconnections and the second preset parameter to obtain the second time interval comprises:
[0055] multiplying the total number of reconnections and the second adjustment time parameter to obtain the second time interval.
[0056] With reference to the first aspect, in a thirteenth possible implementation manner of the first aspect, the determination of whether the preset network service device restart condition is met comprises:
[0057] In a case where the network is a wireless network, determining whether the second time interval is greater than or equal to a preset time interval threshold; in a case where the second time interval is greater than or equal to the preset time interval threshold, reconnecting the network service device according to the preset time interval threshold; obtaining a total number of times of reconnecting the network service device according to the preset time interval threshold; and in a case where the total number of times is greater than or equal to a preset number of times threshold, determining that the preset network service device restart condition is met.
[0058] In a case where the network is a wired network, determining a total duration from starting to reconnect the network service device to the present; and in a case where the total duration is greater than or equal to a preset duration threshold, determining that the preset network service device restart condition is met.
[0059] With reference to the first aspect, in a fourteenth possible implementation manner of the first aspect, the method further comprises:
[0060] In a case where it is determined that the connected network is not disconnected, controlling the terminal device to enter a low-power-consumption mode.
[0061] In a case where the indication message sent by the network service device is received, determining a wake-up time according to the indication message; wherein the network service device is configured to generate the wake-up time for the terminal device to enter a normal working mode after buffering data of the terminal device.
[0062] In a case where the wake-up time is reached, controlling the terminal device to enter the normal working mode from the low-power-consumption mode to receive the buffered data of the network service device.
[0063] With reference to the first aspect, in a fifteenth possible implementation manner of the first aspect, the network service device is a router.
[0064] With reference to the first aspect, in a sixteenth possible implementation manner of the first aspect, the network service device is a network access point device.
[0065] With reference to the first aspect, in a seventeenth possible implementation manner of the first aspect, the determining that the connected network is disconnected comprises:
[0066] detecting a connection state of the network in real time;
[0067] determining that the connected network is disconnected according to the connection state.
[0068] With reference to the first aspect, in an eighteenth possible implementation manner of the first aspect, the determining that the connected network is disconnected comprises:
[0069] detecting a connection state of the network in real time;
[0070] determining that the connected network is disconnected according to the connection state.
[0071] The second aspect, the application further provides a network connection device, applied to a terminal device, the terminal device connects a network through an access network service device, the device comprises:
[0072] a first reconnection module, configured to reconnect the network service device according to a preset first time interval in a case where it is determined that the connected network is disconnected;
[0073] a determining module, configured to determine whether a preset stop-reconnection condition is met at present in a case where the reconnection with the network service device is not successful;
[0074] an executing module, configured to perform a restart operation in a case where it is determined that the stop-reconnection condition is met at present;
[0075] a second reconnection module, configured to reconnect the network service device according to a preset reconnection strategy after the restart operation is completed, a second time interval for reconnecting the network service device in the reconnection strategy is increased in turn, and the reconnection with the network service device is stopped in a case where a preset network service device restart condition is met.
[0076] With reference to the second aspect, in a first possible implementation manner of the second aspect, the network is a wireless network, and the first reconnection module is specifically configured to:
[0077] scan a plurality of wireless hotspots at present according to the first time interval;
[0078] obtain a signal strength of each wireless hotspot;
[0079] determining a first number threshold of the wireless hotspot according to the signal strength of the wireless hotspot, the first number threshold being proportional to the signal strength;
[0080] reconnecting, in sequence according to the first number threshold corresponding to each wireless hotspot, the network service device of the corresponding wireless hotspot according to the signal strength of the scanned wireless hotspot from large to small, until a network service device is reconnected.
[0081] With reference to the second aspect, in a second possible implementation manner of the second aspect, the determining module is specifically configured to:
[0082] obtain a reconnection number of the current initiated reconnection;
[0083] determine whether the reconnection number is greater than a preset second number threshold;
[0084] determine that a preset stop reconnection condition is met currently in a case where it is determined that the reconnection number is greater than the second number threshold.
[0085] With reference to the second aspect, in a third possible implementation manner of the second aspect, the determining module is specifically configured to:
[0086] obtain a total reconnection time length of the reconnection initiated to the network service device;
[0087] determine whether the total reconnection time length is greater than or equal to a preset time length threshold;
[0088] determine that a preset stop reconnection condition is met currently in a case where it is determined that the total reconnection time length is greater than or equal to the time length threshold.
[0089] With reference to the second aspect, in a fourth possible implementation manner of the second aspect, the executing module is specifically configured to:
[0090] obtain a current value of a preset restart flag;
[0091] perform a restart operation in a case where it is determined that the current value is a first preset value;
[0092] The apparatus further includes:
[0093] a updating module configured to update the current value of the restart flag from the first preset value to a second preset value, the second preset value being used to represent that the terminal device has been restarted currently.
[0094] With reference to the second aspect, in a fifth possible implementation manner of the second aspect, the second reconnection module includes:
[0095] an obtaining sub-module configured to obtain a total reconnection number from disconnection from the network to the current initiated reconnection;
[0096] a first determining sub-module, configured to determine a current second time interval according to the total number of reconnections;
[0097] a reconnection sub-module, configured to reconnect the network service device after the second time interval is reached;
[0098] a second determining sub-module, configured to determine whether the network service device is successfully connected and whether a network service device restart condition is met at present;
[0099] a first executing sub-module, configured to return to execute the step of acquiring the total number of reconnections initiated from disconnection from the network to present, in a case where it is determined that the network service device is not successfully connected and the network service device restart condition is not met at present;
[0100] a second executing sub-module, configured to output prompt information for prompting a restart operation on the network service device to the network service device to enable the network service device to perform the restart operation, in a case where it is determined that the network service device is not successfully connected and it is determined that the network service device restart condition is met at present.
[0101] With reference to the second aspect, in a sixth possible implementation manner of the second aspect, the first determining sub-module is specifically configured to:
[0102] in a case where the network is a wireless network, perform a first preset operation on a difference between the total number of reconnections and the second number threshold to obtain the second time interval;
[0103] in a case where the network is a wired network, perform a second preset operation on the total number of reconnections and a second preset parameter to obtain the second time interval.
[0104] With reference to the second aspect, in a seventh possible implementation manner of the second aspect, the second determining sub-module is specifically configured to:
[0105] in a case where the network is a wireless network, determine whether the second time interval is greater than or equal to a preset time interval threshold; in a case where the second time interval is greater than or equal to the preset time interval threshold, reconnect the network service device according to the preset time interval threshold; acquire a total number of times of reconnection of the network service device according to the preset time interval threshold; and in a case where the total number of times is greater than or equal to a preset number threshold, determine that a preset network service device restart condition is met at present;
[0106] In a case that the network is a wired network, a total time length from starting to reconnect the network service device to the present is determined; in a case that the total time length is greater than or equal to a preset time threshold, it is determined that the preset network service device restart condition is met at present.
[0107] With reference to the second aspect, in an eighth possible implementation manner of the second aspect, the apparatus further includes:
[0108] The first control module is configured to control the terminal device to enter a low-power consumption mode in a case that it is determined that the connected network is not disconnected.
[0109] The wake-up time determination module is configured to determine a wake-up time according to the indication message in a case that the indication message sent by the network service device is received; wherein the network service device is configured to generate the wake-up time indicating the terminal device to enter a normal working mode after buffering the data of the terminal device.
[0110] The second control module is configured to control the terminal device to enter the normal working mode from the low-power consumption mode in a case that the wake-up time is reached, so as to receive the buffered data of the network service device.
[0111] In a third aspect, the present application further provides an electronic device, including a processor and a memory, the processor is used to execute a network connection program stored in the memory, so as to realize the network connection method in any one of the first aspect.
[0112] In a fourth aspect, the present application further provides a storage medium, characterized in that the storage medium stores one or more programs, the one or more programs can be executed by one or more processors to realize the network connection method in any one of the first aspect.
[0113] The technical scheme provided in the embodiments of the present application comprises the following steps: in the case that the connected network is disconnected, the network service device is reconnected according to a preset first time interval; in the case that the network service device is not reconnected successfully, it is determined whether the preset stop-reconnection condition is met at present; in the case that the stop-reconnection condition is met at present, a restart operation is performed; after the restart operation is completed, the network service device is reconnected according to a preset reconnection strategy; and the second time interval for reconnection to the network service device in the reconnection strategy is increased successively, and the reconnection to the network service device is stopped in the case that the preset network service device restart condition is met. The technical scheme comprises the following steps: in the case that the network connected by the terminal device is disconnected, it is determined whether the network service device can be accessed by the method of reconnection at a fixed time; in the case that the access fails, the terminal device is restarted to determine whether the access logic of the terminal device is problematic; and after the terminal device is restarted, the terminal device is reconnected by gradually increasing the time interval until the preset network service device restart condition is met. The technical scheme can reduce the number of reconnections, ensure that the terminal device is reconnected to the network service device within a preset time period, ensure that the terminal device can be reconnected to the network service device, reduce the power consumption of the terminal device caused by reconnection to the network service device, increase the available time of the terminal device in one charging, and ensure the low-power consumption requirement of the terminal device, thereby improving the user experience. BRIEF DESCRIPTION OF DRAWINGS
[0114] In order to more clearly illustrate the technical scheme of the present application, the drawings required in the embodiments will be briefly introduced. Obviously, other drawings can be obtained by those skilled in the art without any creative labor on the basis of these drawings.
[0115] FIG. 1 is an embodiment flowchart of a network connection method provided by the present application;
[0116] FIG. 2 is an embodiment flowchart of another network connection method provided by the present application;
[0117] FIG. 3 is an embodiment block diagram of a network connection device provided by the present application;
[0118] FIG. 4 is a structural schematic diagram of an electronic device provided by the present application. DETAILED DESCRIPTION
[0119] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the following will clearly and completely text the technical scheme in the embodiments of the present application with reference to the drawings in the embodiments of the present application. Obviously, the texted embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.
[0120] The following disclosure provides many different embodiments, or examples, for implementing different structures of the present application. For the purpose of simplifying the present application disclosure, the components and settings of specific examples are texted in the following. Of course, they are only examples, and the purpose is not to limit the present application. In addition, the present application can repeatedly refer to numbers and / or letters in different examples. Such repetition is for the purpose of simplification and clarity, and does not indicate the relationship between the various embodiments and / or settings discussed.
[0121] In order to solve the technical problem in the prior art that the terminal device needs to constantly try to reconnect the network in the case of weak signal / no signal / no network, resulting in large power consumption of the terminal device, thereby reducing the available time of a charge, and failing to guarantee the low power consumption requirement, affecting the user experience, the present application provides a network connection method and device, which can determine whether the network service device can be accessed by the terminal device through the method of timing reconnection in the case of disconnection of the network connected by the terminal device, and after access fails, the terminal device can be restarted to exclude whether it is an access logic problem of the terminal device, and after restarting, the terminal device is reconnected in a gradually increasing interval time, until the interval time reaches a preset time interval threshold. This reduces the number of reconnections while ensuring that the terminal device reconnects to the network service device within a preset time period, which realizes the terminal device to reconnect to the network service device while reducing the power consumption of the terminal device due to reconnection to the network service device, thereby increasing the available time of a charge of the terminal device, guaranteeing the low power consumption requirement of the terminal device, and improving the user experience.
[0122] The network connection method provided by the present application will be further explained and described below with reference to the specific embodiments and the accompanying drawings. The embodiments do not constitute a limitation on the embodiments of the present application.
[0123] Referring to FIG. 1, an embodiment flowchart of a network connection method provided by the present application is shown. As an embodiment, the method can be applied to a terminal device, which can connect to a network by accessing a network service device. As shown in FIG. 1, the flowchart can include the following steps:
[0124] Step 101, in the case of determining that the connected network is disconnected, reconnecting the network service device according to a preset first time interval.
[0125] The network can be a wireless network, a wired network, or other network, and the embodiments of the present application do not limit the network.
[0126] The network service device refers to a device for providing a network, such as a router, an AP (Access Point) device, or the like.
[0127] In an embodiment, the subject performing the embodiments of the present application is a terminal device having a network module, which accesses a network service device to connect to a network and transmit data through the network.
[0128] Therefore, to ensure normal operation of the device, the terminal device can detect the connection state of the network in real time or at regular intervals.
[0129] Optionally, when it is determined that the network connection is normal, i.e., not disconnected, to save power consumption, the terminal device can be controlled to enter a low-power mode. Then, in this mode, the network service device can send an indication message to the terminal device at regular intervals to maintain the connection with the terminal device. The indication message can be a wake-up time for instructing the terminal device to wake up from the low-power mode to enter a normal working mode to receive data, such as a DTIM (Delivery Traffic Indication Map) when the network is a wireless network, or a TCP (Transmission Control Protocol) message when the network is another network.
[0130] Therefore, when the terminal device receives the indication message sent by the network service device, the terminal device can determine the wake-up time according to the indication message, and when the wake-up time is reached, the terminal device can be controlled to enter the normal working mode from the low-power mode to receive the data buffered by the network service device.
[0131] Optionally, when it is determined that the connected network is disconnected, to timely connect to the network to ensure normal use of the terminal device, the terminal device can attempt to reconnect to the network service device.
[0132] Further, to save power consumption, the terminal device can reconnect to the network service device at a preset first time interval. The first time interval can be a time interval preset by a user, such as 3 s or 5 s, or the like.
[0133] As an optional embodiment, when the network is a wireless network, the terminal device can scan a plurality of wireless hotspots existing around every first time interval (e.g., 3 s).
[0134] As an example embodiment, in a case that the scanned wireless hotspot includes a target wireless hotspot corresponding to the preset network service device, the preset network service device can be reconnected according to the wireless hotspot.
[0135] It can be understood that, in a case that the target wireless hotspot is not the wireless hotspot with the strongest signal among the scanned wireless hotspots, the network service device corresponding to the wireless hotspot with the strongest signal can be preferentially reconnected.
[0136] Further, in a case that the preset network service device cannot be connected due to a fault or the like, the continuous reconnection operation of the terminal device is a redundant operation. Based on this, the terminal device can limit the reconnection times of the preset network service device. Therefore, the terminal device can count the reconnection times of the network service device (hereinafter referred to as a first reconnection times for the sake of description).
[0137] Optionally, in a case that the first reconnection times is greater than a preset first number threshold, it indicates that the preset network service device cannot be reconnected at this time. Therefore, the other network service devices corresponding to the other wireless hotspots scanned can be reconnected, and the reconnection times of each other network service device can be limited to the first number threshold.
[0138] As another example embodiment, the signal strength of each wireless hotspot can be acquired, and for each wireless hotspot, the first number threshold of the wireless hotspot can be determined according to the signal strength of the wireless hotspot. The first number threshold refers to the upper limit of the number of times of initiating connection to the network service device corresponding to the wireless hotspot. The first number threshold can be proportional to the signal strength of the corresponding wireless hotspot. It can be understood that the first number thresholds of the wireless hotspots without signal strength can be the same or different.
[0139] Optionally, the correspondence between the signal strength range of the wireless hotspot and the first number threshold can be pre-stored. Based on this, when the first number threshold corresponding to each wireless signal is determined, the target signal strength range to which the signal strength of the wireless signal belongs can be determined first, and the first number threshold corresponding to the strength range can be determined from the pre-stored correspondence according to the target signal strength range.
[0140] Subsequently, the network service devices of the corresponding wireless hotspots can be reconnected according to the first number threshold corresponding to each wireless hotspot in the order of the signal strength of the scanned wireless hotspots from large to small, until the last network service device is connected or the current stop reconnection condition is met.
[0141] As an embodiment, the terminal device re-connects the network service device of each wireless hotspot in the order of the signal strength of the scanned wireless hotspot from large to small according to the first number threshold corresponding to each wireless hotspot, and can count the re-connecting number of the network service device of the current wireless hotspot to be connected (for convenience of description, the first re-connecting number is referred to below).
[0142] Optionally, when the first re-connecting number is greater than the preset first number threshold, it indicates that the network service device cannot be re-connected at this time, and therefore, the network service device of the next wireless hotspot can be connected in the order of the signal strength from large to small.
[0143] As another optional embodiment, when the network is a wired network, the terminal device can initiate the re-connection to the network service device every first time interval (for example, 3s).
[0144] The terminal device can preferentially initiate the re-connection request to the network service device connected last time, and when the re-connecting number reaches the preset number threshold, switch to initiate the re-connection request to other network service devices until the last network service device is re-connected or the preset stop re-connection condition is reached. The network service device and the other network service devices can be any network service device in the same network device cluster.
[0145] Step 102, in the case that the re-connection to the network service device is not successful, determine whether the preset stop re-connection condition is met.
[0146] Step 103, in the case that the stop re-connection condition is met, perform the restart operation.
[0147] The steps 102 and 103 are described uniformly as follows:
[0148] The stop re-connection condition refers to the condition that needs to be met when the terminal device stops the re-connection operation.
[0149] The restart operation refers to the operation of restarting the terminal device.
[0150] In the embodiment of the application, in order to prevent the terminal device from accessing the network service device and causing logical problems, thereby failing to successfully re-connect to the network service device, the terminal device can determine whether the stop re-connection condition is met after multiple re-connection operations, and perform the restart operation in the case that the stop re-connection condition is met, so that the terminal device can be restarted to eliminate possible network access logical problems of the terminal device.
[0151] As an optional implementation, the reconnection times of the terminal device in the current initiated reconnection can be acquired, where the reconnection times refer to the total times from determining network disconnection to the current initiated reconnection operation.
[0152] Then, it can be determined whether the reconnection times are greater than a preset second number threshold, and in a case where it is determined that the reconnection times are greater than the second number threshold, it is determined that the preset stop reconnection condition is met at present.
[0153] As another optional implementation, the total reconnection duration of initiating reconnection to the network service device can be acquired. The total reconnection duration here refers to the total duration from determining network disconnection and starting to initiate the reconnection operation to the present.
[0154] Then, it can be determined whether the total reconnection duration is greater than or equal to a preset duration threshold, and in a case where it is determined that the total reconnection duration is greater than or equal to the duration threshold, it is determined that the preset stop reconnection condition is met at present.
[0155] In an embodiment, the logical problem that the terminal device can have can be excluded by performing a restart operation, but the logical problem can be excluded by performing the restart operation once, and if the restart operation is performed multiple times, not only the device resources can be damaged, but also the user experience can be affected. Therefore, in order to prevent the terminal device from being restarted multiple times, in the embodiment of the present application, a restart flag bit can be preset, which is used to indicate whether the terminal device has performed a restart operation when performing network reconnection.
[0156] Optionally, when the restart flag bit is a first preset value (for example, 0), it can be indicated that the terminal device has not performed a restart operation when performing the reconnection operation; when the restart flag bit is a second preset value (for example, 1), it can be indicated that the terminal device has performed a restart operation when performing the reconnection operation.
[0157] Based on this, when the terminal device performs a restart operation, the current value of the preset restart flag bit can be acquired.
[0158] Optionally, in a case where the current value is the first preset value, it can be determined that the terminal device has not performed a restart operation, and therefore the restart operation can be performed. Then, the current value of the restart flag bit can be updated from the first preset value to the second preset value.
[0159] On the contrary, in a case where the current value is the second preset value, it can be determined that the terminal device has performed a restart operation, and therefore the restart operation can not be performed, and the network service device can be reconnected directly according to the reconnection strategy in the following step 104, which will not be described here.
[0160] In step 104, after the above-mentioned restart operation is completed, the network service device is reconnected according to a preset reconnection strategy. In the reconnection strategy, a second time interval for reconnection of the network service device is sequentially increased, and the reconnection of the network service device is stopped when a preset network service device restart condition is met.
[0161] The reconnection strategy is a strategy of reconnection to the network service device according to a dynamic second time interval, and the reconnection of the network service device is stopped when a preset network service device restart condition is met. The second time interval is a time sequence that is sequentially increased.
[0162] The network service device restart condition is a condition that is met when the network service device cannot be reconnected and needs to be restarted. The condition can be that the number of reconnection times is large, or the time consumed by reconnection is large, and the like. The embodiments of the present application do not limit this.
[0163] In the embodiments of the present application, after the terminal device is restarted, if the terminal device is not successfully connected when reconnecting to the network service device, when reconnection is initiated again, in order to reduce power consumption, the terminal device can continuously increase the length of the second time interval when initiating the reconnection operation according to the second time interval, until the preset network service device restart condition is met, so that the power consumption is reduced and the terminal device can be successfully connected to the network service device within a set time.
[0164] Specifically, how to reconnect the network service device according to the preset reconnection strategy will be described below with reference to the flowchart shown in FIG. 2, which will not be described in detail here.
[0165] The technical scheme provided in the embodiments of the present application comprises the following steps: in the case that the connected network is disconnected, the terminal device reconnects the network service device according to a preset first time interval; in the case that the terminal device fails to reconnect the network service device, it is determined whether the preset stop-reconnection condition is met at present; in the case that the stop-reconnection condition is met at present, a restart operation is performed; after the restart operation is completed, the terminal device reconnects the network service device according to a preset reconnection strategy, the second time interval for reconnecting the network service device in the reconnection strategy is increased, and the terminal device stops reconnecting the network service device in the case that the preset network service device restart condition is met. This technical scheme, in the case that the network connected by the terminal device is disconnected, firstly determines whether the terminal device can access the network service device by means of the timed reconnection method, and after the access fails, the terminal device is restarted to exclude whether the access logic of the terminal device has a problem, and after the restart, the terminal device reconnects the network service device by gradually increasing the interval time until the preset network service device restart condition is met. This can reduce the number of reconnections while ensuring that the terminal device reconnects the network service device within a preset time period, thereby achieving the purpose of ensuring that the terminal device can reconnect the network service device while reducing the power consumption of the terminal device due to the reconnection of the network service device, thereby increasing the available time of the terminal device for one charging, ensuring the low-power consumption requirement of the terminal device, and improving the user experience.
[0166] Referring to FIG. 2, an embodiment flowchart of another network connection method provided in the embodiments of the present application is shown. The flowchart shown in FIG. 2 describes how to reconnect the network service device according to a preset reconnection strategy on the basis of the flowchart shown in FIG. 1. As shown in FIG. 2, the flowchart can comprise the following steps:
[0167] Step 201: Obtain the total number of reconnections initiated from the network disconnection to the present.
[0168] The total number of reconnections refers to the total number of reconnections initiated by the terminal device from the network disconnection to the present after the terminal device is restarted. The difference between the total number of reconnections and the number of reconnections in step 103 is that the time nodes for counting are different. The total number of reconnections is the total number of reconnections initiated by the terminal device from the network disconnection to the present after the terminal device is restarted, and the number of reconnections is the total number of reconnections initiated by the terminal device from the network disconnection to the counting time before the terminal device is restarted.
[0169] In an embodiment, the terminal device can have a counter, which is incremented by 1 each time the terminal device initiates a reconnection operation. Based on this, the terminal device can directly obtain the current counting value of the counter when determining the total number of reconnections, and determine the total number of reconnections initiated from the network disconnection to the present as the counting value.
[0170] Step 202, determining the current second time interval according to the total reconnection times.
[0171] Step 203, reconnecting the network service device after reaching the second time interval.
[0172] The steps 202 and 203 are described as follows:
[0173] The second time interval is a time period corresponding to the reconnection operation of the terminal device to the network service device after the terminal device performs the restart operation.
[0174] In the embodiment, in order to reduce the number of reconnection operations and save power consumption, the terminal device can increase the length of the second time interval to reduce the number of reconnection operations.
[0175] In this regard, the terminal device can determine the second time interval according to the total reconnection times of the terminal device each time the terminal device initiates the reconnection operation, and reconnect the network service device after reaching the second time interval.
[0176] As an optional implementation, in the case that the network is a wireless network, the total reconnection times can be subtracted from the second number threshold to obtain a reconnection times difference, and the reconnection times difference can be subjected to a first preset operation with a first preset parameter to obtain the second time interval. The first preset operation can be a multiplication operation or other operations, and the embodiment is not limited in this regard.
[0177] The first preset parameter can be a first adjustment time parameter, for example, 60s. The second number threshold is a number threshold corresponding to step 103 in the flow shown in FIG. 1, which is used to measure whether to perform the restart operation on the terminal device. That is, when the reconnection times of the terminal device performing the reconnection operation is greater than the second number threshold, the restart operation can be performed on the terminal device.
[0178] As an exemplary embodiment, the terminal device can multiply the reconnection times difference by the first adjustment time parameter to obtain the second time interval.
[0179] As another optional implementation, in the case that the network is a wired network, the total reconnection times can be subjected to a second preset operation with a second preset parameter to obtain the second time interval. The second preset operation can be a multiplication operation or other operations, and the embodiment is not limited in this regard. The second preset parameter can be a second adjustment time parameter, which can be the same as the first adjustment time parameter, for example, 60s, or different from the first preset parameter, for example, 90s, and the embodiment is not limited in this regard.
[0180] As an exemplary embodiment, the reconnection times can be multiplied by the second adjustment time parameter (for example, 60s) to obtain a second time interval.
[0181] Step 204: determining whether the network service device is successfully connected and whether the network service device restart condition is met at present.
[0182] Step 205: returning to step 201 to determine a new second time interval and to reconnect the network service device, in the case that the network service device is not successfully connected and the network service device restart condition is not met at present.
[0183] Step 206: ending the flow in the case that the network service device is successfully connected.
[0184] Step 207: outputting prompt information to the network service device to prompt the network service device to perform a restart operation, in the case that the network service device is not successfully connected and the network service device restart condition is met at present.
[0185] The steps 204-207 are described as follows:
[0186] The network service device restart condition refers to the condition for limiting the stop of the reconnection operation on the network service device in step 104, which can include but is not limited to a large number of reconnection times, a long time consumed by the reconnection, etc.
[0187] In the embodiments of the present application, in the case of reconnecting the network service device, it can be determined whether the network service device is successfully connected and whether the network service device restart condition is met at present.
[0188] Optionally, in the case that the network service device is not successfully connected and the network service device restart condition is not met at present, the step 201 can be returned to determine a new second time interval and to reconnect the network service device.
[0189] Optionally, in the case that the network service device is successfully connected, it indicates that the reconnection of the network service device is completed, and the flow can be ended at this time.
[0190] Optionally, in the case that the network service device is not successfully connected and the network service device restart condition is met at present, it indicates that the network service device cannot be reconnected at this time, and therefore the prompt information for prompting the network service device to perform a restart operation can be output to the network service device to make the network service device perform a restart operation, so as to eliminate the fault of the network service device and to successfully reconnect the network service device.
[0191] Further, in determining whether the preset network service device restart condition is met at present, different determinations can be made according to different network connection modes.
[0192] As an optional implementation, when the network is a wireless network, it can be determined whether the current second time interval is greater than or equal to a preset time interval threshold. The preset time interval threshold is a preset time threshold. When the second time interval reaches the time interval threshold, the length of the second time interval can no longer be increased.
[0193] Optionally, in a case where it is determined that the second time interval is greater than or equal to the preset time interval threshold, in order to prevent the terminal device from being unable to complete reconnection to the network service device within a set time, the terminal device can directly reconnect to the network service device according to the preset time interval threshold when it is determined that the second time interval is greater than or equal to the preset time interval threshold.
[0194] Further, in the process of reconnecting to the network service device according to the preset time interval threshold, the total number of times of reconnecting to the network service device according to the preset time interval threshold can be obtained. Then, it can be determined whether the total number of times is greater than or equal to a preset number threshold. The number threshold can be determined according to the set time of the user, that is, if the network service device is successfully reconnected within the set time, the maximum number of times of reconnecting to the network service device according to the preset time interval threshold is the number threshold.
[0195] Optionally, if it is determined that the total number of times is greater than or equal to the number threshold, it can be determined that the preset network service device restart condition is met at present.
[0196] Optionally, if it is determined that the total number of times is less than the number threshold, it can be determined that the preset network service device restart condition is not met at present.
[0197] As another optional implementation, when the network is a wired network, in determining whether the preset network service device restart condition is met at present, the total length of time consumed from starting to reconnect to the network service device to the present can be determined, and it can be determined whether the total length of time is greater than or equal to a preset length threshold.
[0198] Optionally, in a case where it is determined that the total length of time is greater than or equal to the length threshold, it indicates that the time consumed for reconnection to the network is too long at this time, and the network service device can be restarted, so it can be determined that the preset network service device restart condition is met at present.
[0199] Optionally, in a case where it is determined that the total length of time is less than the length threshold, it indicates that the length of time for reconnection to the network service device does not exceed the preset length at this time, and reconnection to the network service device can continue, so it can be determined that the preset network service device restart condition is not met at present.
[0200] The technical scheme provided by the embodiment of the application comprises the following steps: obtaining the total number of reconnection times from network disconnection to the present; determining the second time interval according to the total number of reconnection times; reconnecting the network service device after the second time interval is reached; determining whether the network service device is successfully connected; determining whether the network service device restart condition is met at present; returning to the step of obtaining the total number of reconnection times from network disconnection to the present in the case that the network service device is not successfully connected and the network service device restart condition is not met at present; and outputting prompt information for prompting the network service device to perform a restart operation in the case that the network service device is not successfully connected and the network service device restart condition is met at present, so that the network service device performs the restart operation. According to the technical scheme, when the terminal device is restarted and the terminal device is not successfully connected to the network service device when reconnecting the network service device, the second time interval can be increased until the network service device restart condition is met, so that the terminal device is successfully connected to the network service device within a set time while power consumption is reduced.
[0201] Referring to FIG. 3, an embodiment block diagram of a network connection device provided by the embodiment of the application is shown. As an embodiment, the device can be applied to a terminal device, and the terminal device can connect to a network by accessing a network service device. As shown in FIG. 3, the device can comprise:
[0202] The first reconnection module 31 is configured to reconnect the network service device according to a preset first time interval in the case that the connected network is disconnected.
[0203] The determination module 32 is configured to determine whether a preset stop reconnection condition is met at present in the case that the network service device is not successfully reconnected.
[0204] The execution module 33 is configured to perform a restart operation in the case that the stop reconnection condition is met at present.
[0205] The second reconnection module 34 is configured to reconnect the network service device according to a preset reconnection strategy after the restart operation is completed, the second time interval for reconnecting the network service device in the reconnection strategy is increased in turn, and the network service device is stopped from being reconnected in the case that a preset network service device restart condition is met.
[0206] As a possible implementation manner, the network is a wireless network, and the first reconnection module 31 is specifically configured to:
[0207] scan a plurality of wireless hotspots according to the first time interval;
[0208] acquire a signal strength of each of the wireless hotspots;
[0209] determine, for each of the wireless hotspots, a first number threshold of the wireless hotspot according to the signal strength of the wireless hotspot, the first number threshold being proportional to the signal strength;
[0210] reconnect, according to the first number threshold corresponding to each of the wireless hotspots, a network service device of the corresponding wireless hotspot in a descending order of the signal strength of the scanned wireless hotspots, until a last network service device is reconnected.
[0211] As a possible implementation, the determining module 32 is specifically configured to:
[0212] acquire a reconnection number of a current initiated reconnection;
[0213] determine whether the reconnection number is greater than a preset second number threshold;
[0214] determine that a preset stop reconnection condition is met currently in a case where it is determined that the reconnection number is greater than the second number threshold.
[0215] As a possible implementation, the determining module 32 is specifically configured to:
[0216] acquire a total reconnection time length of the reconnection to the network service device;
[0217] determine whether the total reconnection time length is greater than or equal to a preset time length threshold;
[0218] determine that a preset stop reconnection condition is met currently in a case where it is determined that the total reconnection time length is greater than or equal to the time length threshold.
[0219] As a possible implementation, the executing module 33 is specifically configured to:
[0220] acquire a current value of a preset restart flag;
[0221] perform a restart operation in a case where it is determined that the current value is a first preset value;
[0222] The apparatus further includes:
[0223] an updating module configured to update the current value of the restart flag from the first preset value to a second preset value, the second preset value being used to represent that the terminal device has been restarted currently.
[0224] As a possible implementation, the second reconnection module 34 includes:
[0225] obtain a total number of reconnections from being disconnected from the network to the present time;
[0226] determine a second time interval according to the total number of reconnections;
[0227] reconnect to the network service device after the second time interval is reached;
[0228] determine whether the network service device is successfully connected and whether a network service device restart condition is met at present;
[0229] if the network service device is not successfully connected and the network service device restart condition is not met at present, return to the step of obtaining the total number of reconnections from being disconnected from the network to the present time;
[0230] if the network service device is not successfully connected and the network service device restart condition is met at present, output prompt information for prompting a restart operation of the network service device to the network service device, so that the network service device performs the restart operation.
[0231] As a possible implementation, the first determining sub-module is specifically configured to:
[0232] if the network is a wireless network, obtain a difference value of the total number of reconnections by subtracting the second number threshold from the total number of reconnections, perform a first preset operation on the difference value of the total number of reconnections and a first preset parameter, and obtain the second time interval;
[0233] if the network is a wired network, perform a second preset operation on the total number of reconnections and a second preset parameter, and obtain the second time interval.
[0234] As a possible implementation, the second determining sub-module is specifically configured to:
[0235] if the network is a wireless network, determine whether the second time interval is greater than or equal to a preset time interval threshold; if the second time interval is greater than or equal to the preset time interval threshold, reconnect to the network service device according to the preset time interval threshold; obtain a total number of times of reconnecting to the network service device according to the preset time interval threshold; and if the total number of times is greater than or equal to a preset number threshold, determine that the preset network service device restart condition is met at present;
[0236] In a case that the network is a wired network, a total time length from starting to reconnect the network service device to the present is determined; in a case that the total time length is greater than or equal to a preset time length threshold, it is determined that the preset network service device restart condition is met at present.
[0237] As a possible implementation, the apparatus further comprises (not shown in the figure):
[0238] The first control module is configured to control the terminal device to enter a low-power consumption mode in a case that the connected network is not disconnected;
[0239] The wake-up time determination module is configured to determine a wake-up time according to the indication message in a case that the indication message sent by the network service device is received; wherein the network service device is configured to generate the wake-up time indicating the terminal device to enter a normal working mode after buffering the data of the terminal device.
[0240] The second control module is configured to control the terminal device to enter the normal working mode from the low-power consumption mode in a case that the wake-up time is reached, so as to receive the buffered data of the network service device.
[0241] As shown in FIG. 4, a structure schematic diagram of an electronic device provided by an embodiment of the present application is shown, which comprises a processor 41, a communication interface 42, a memory 43 and a communication bus 44, wherein the processor 41, the communication interface 42 and the memory 43 complete mutual communication through the communication bus 44,
[0242] The memory 43 is configured to store a computer program.
[0243] In an embodiment of the present application, the processor 41 is configured to execute the program stored in the memory 43, so as to implement the network connection method provided by any one of the foregoing method embodiments, comprising:
[0244] In a case that the connected network is disconnected, the network service device is reconnected according to a preset first time interval;
[0245] In a case that the reconnection with the network service device is not successful, it is determined whether a preset stop-reconnection condition is met at present;
[0246] In a case that the stop-reconnection condition is met at present, a restart operation is performed;
[0247] After the restart operation is completed, the network service device is reconnected according to a preset reconnection strategy, a second time interval for reconnection with the network service device in the reconnection strategy is sequentially increased, and in a case that a preset network service device restart condition is met, the reconnection with the network service device is stopped.
[0248] The embodiment of the present application further provides a storage medium, which stores a computer program. The computer program is executed by a processor to implement the steps of the network connection method provided by any one of the preceding method embodiment.
[0249] In the specific implementation, the present application further provides a computer storage medium, which can store a program. The program is executed to include some or all steps of the preceding embodiments. The storage medium can be a magnetic disc, an optical disc, a read-only memory (ROM) or a random access memory (RAM).
[0250] Those skilled in the art can clearly understand that the technology in the embodiments of the present application can be realized by means of software and necessary general hardware platforms. Based on such understanding, the technical solutions in the embodiments of the present application can be embodied in the form of a software product, which can be stored in a storage medium, such as a ROM / RAM, a magnetic disc, an optical disc, etc., and includes a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the method described in the embodiments of the present application or some parts of the embodiments.
[0251] The same or similar parts among the various embodiments in the specification can be referred to each other. In particular, for the … embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant part can be referred to the description in the method embodiment.
[0252] The above-described embodiments of the present application do not constitute a limitation on the protection scope of the present application.
Claims
1. A network connection method characterized by, The method is applied to a terminal device connected to a network through an access network service device, and comprises the following steps: In the case of determining that the connected network is disconnected, reconnecting the network service device according to a preset first time interval; In the case of not reconnecting the network service device successfully, determining whether a preset stop reconnecting condition is met at present; In the case of determining that the stop reconnecting condition is met at present, performing a restart operation; After completing the restart operation, reconnecting the network service device according to a preset reconnecting strategy, wherein a second time interval for reconnecting the network service device in the reconnecting strategy is sequentially increased, and in the case of meeting a preset network service device restart condition, the reconnecting of the network service device is stopped.
2. The method of claim 1, wherein, The network is a wireless network, and the reconnecting of the network service device according to the preset first time interval comprises the following steps: Scanning a plurality of wireless hotspots at present according to the first time interval; Obtaining a signal strength of each wireless hotspot; For each wireless hotspot, determining a first number threshold of the wireless hotspot according to the signal strength of the wireless hotspot, wherein the first number threshold is proportional to the signal strength; According to the signal strength of the scanned wireless hotspots from large to small, sequentially reconnecting the network service device of each wireless hotspot according to the first number threshold corresponding to the wireless hotspot until reconnecting a network service device.
3. The method of claim 2, wherein, The determination of the first number threshold of the wireless hotspot according to the signal strength of the wireless hotspot comprises the following steps: From a plurality of preset signal strength ranges, determining a target signal strength range to which the signal strength of the wireless hotspot belongs; According to the target signal strength range, determining a first number threshold corresponding to the target signal strength range from a preset corresponding relationship between the signal strength range and the first number threshold.
4. The method of claim 2, wherein, The sequential reconnecting of the network service device of each wireless hotspot according to the first number threshold corresponding to the wireless hotspot comprises the following steps: For the current wireless hotspot to be connected, counting a first reconnecting number of the network service device of the wireless hotspot; In the case of determining that the first reconnecting number is greater than the first number threshold, reconnecting the network service device of the next wireless hotspot.
5. The method of claim 1, wherein, The network is a wired network, and the reconnecting of the network service device according to the preset first time interval comprises the following steps: According to the first time interval, initiating a reconnecting request to the network service device connected last time; In the case of the reconnecting number of the initiated reconnecting request reaching a preset number threshold, initiating a reconnecting request to other network service devices until reconnecting a network service device or reaching a preset stop reconnecting condition; wherein the network service device connected last time and the other network service devices are any network service device in a same network device cluster.
6. The method of claim 1, wherein, The determination of whether the preset stop reconnecting condition is met at present comprises the following steps: Obtaining a reconnecting number of the initiated reconnecting at present; Determining whether the reconnecting number is greater than a preset second number threshold; In a case where the reconnection times is determined to be greater than the second times threshold, it is determined that a preset stop reconnection condition is currently met.
7. The method of claim 1, wherein, The determination of whether the preset stop reconnection condition is currently met comprises: acquiring a total reconnection time length of reconnection initiated to the network service device; determining whether the total reconnection time length is greater than or equal to a preset time threshold; In a case where the total reconnection time length is determined to be greater than or equal to the time threshold, it is determined that a preset stop reconnection condition is currently met.
8. The method of claim 1, wherein, The execution of the restart operation comprises: acquiring a current value of a preset restart flag bit; In a case where the current value is determined to be a first preset value, a restart operation is executed. The method further comprises: updating the current value of the restart flag bit from the first preset value to a second preset value, the second preset value being used to represent that the terminal device has been restarted currently.
9. The method of claim 6, wherein, The reconnection to the network service device according to the preset reconnection strategy comprises: acquiring a total reconnection times initiated from the network disconnection to the present; determining a second time interval according to the total reconnection times; reconnecting to the network service device after the second time interval is reached; determining whether the network service device is successfully connected and determining whether the network service device restart condition is currently met; In a case where the network service device is determined to be not successfully connected and the network service device restart condition is determined to be not currently met, the step of acquiring the total reconnection times initiated from the network disconnection to the present is returned to be executed; In a case where the network service device is determined to be not successfully connected and the network service device restart condition is determined to be currently met, prompt information for prompting a restart operation of the network service device is output to the network service device, so that the network service device executes the restart operation.
10. The method of claim 9, wherein, The terminal device comprises a counter, which is used to count a total number of reconnection operations initiated by the terminal device in a process from the determination of network disconnection to the present initiation of a reconnection operation; The acquisition of the total reconnection times initiated from the network disconnection to the present comprises: acquiring a count value counted by the counter currently; determining the count value as the total reconnection times.
11. The method of claim 9, wherein, The determination of the second time interval according to the total reconnection times comprises: In a case where the network is a wireless network, a reconnection times difference value is obtained by subtracting the second times threshold from the total reconnection times; the second time interval is obtained by performing a first preset operation on the reconnection times difference value and a first preset parameter; In a case where the network is a wired network, the second time interval is obtained by performing a second preset operation on the total reconnection times and a second preset parameter.
12. The method of claim 11, wherein, The first preset parameter is a first preset adjustment time parameter, and the obtaining of the second time interval by performing the first preset operation on the reconnection times difference value and the first preset parameter comprises: multiplying the reconnection times difference value and the first adjustment time parameter to obtain the second time interval.
13. The method of claim 11, wherein, The second preset parameter is a second preset adjustment time parameter, and the second preset operation of the total number of reconnections and the second preset parameter is performed to obtain the second time interval, including: The total number of reconnections is multiplied by the second adjustment time parameter to obtain the second time interval.
14. The method of claim 9, wherein, The determination of whether the preset network service device restart condition is met currently includes: In the case of a wireless network, it is determined whether the second time interval is greater than or equal to a preset time interval threshold; in the case that the second time interval is greater than or equal to the preset time interval threshold, the network service device is reconnected according to the preset time interval threshold; the total number of times of reconnecting the network service device according to the preset time interval threshold is obtained; in the case that the total number of times is greater than or equal to a preset number of times threshold, it is determined that the preset network service device restart condition is met currently; In the case of a wired network, the total duration from starting to reconnect the network service device to the current time is determined; in the case that the total duration is greater than or equal to a preset duration threshold, it is determined that the preset network service device restart condition is met currently.
15. The method of claim 1, wherein, Further comprising: In the case that the connected network is not disconnected, the terminal device is controlled to enter a low-power consumption mode; In the case that the network service device sends an indication message, the wake-up time is determined according to the indication message; wherein the network service device is used to generate a wake-up time indicating that the terminal device enters a normal working mode after buffering the data of the terminal device; When the wake-up time is reached, the terminal device is controlled to enter a normal working mode from a low-power consumption mode to receive the buffered data of the network service device.
16. The method of claim 1, wherein, The network service device is a router.
17. The method of claim 1, wherein, The network service device is a network access point device.
18. The method of claim 1, wherein, The determination of the disconnection of the connected network includes: Real-time detection of the connection state of the network; According to the connection state, it is determined that the connected network is disconnected.
19. The method of claim 1, wherein, The determination of the disconnection of the connected network includes: Timely detection of the connection state of the network; According to the connection state, it is determined that the connected network is disconnected.
20. A network connection device, characterized by Applied to a terminal device, the terminal device connects a network by accessing a network service device, and the device includes: A first reconnection module for reconnecting the network service device according to a preset first time interval in the case that the connected network is disconnected; A determination module for determining whether a preset stop reconnection condition is met currently in the case that the network service device is not successfully reconnected; An execution module for performing a restart operation in the case that it is determined that the stop reconnection condition is met currently; A second reconnection module for reconnecting the network service device according to a preset reconnection strategy after the restart operation is completed, the second time interval of the reconnection strategy for reconnecting the network service device is sequentially increased, and the reconnection of the network service device is stopped in the case that the preset network service device restart condition is met.
Citation Information
Patent Citations
Network reconnection method and device
CN106973404A
Network connection method and apparatus
CN107135536A
Network connection method and device
CN113015226A
Method and device for determining network search period, terminal and storage medium
CN114710824A
Wi-Fi automatic reconnection method and device, intelligent terminal and storage medium
CN116017632A