Network connection processing method and device, product, equipment and medium
By generating appropriate reconnection time information for each device after restart in the Internet of Things system, the problem of excessive load pressure caused by concentrated reconnection of the device after the server restart is solved, and the server stability is improved.
Patent Information
- Application Number
- CN202411927032.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-29
AI Technical Summary
In the Internet of Things system, when the server restarts, all connected devices are disconnected, resulting in centralized requests being initiated when the device is reconnected, resulting in excessive load pressure on the server and affecting stability.
By obtaining the restart time and connected device information, the reconnection time information of each target device is generated, and the device is reconnected according to the indicated time range after the server is restarted, avoiding a large number of reconnection requests in a short time.
It effectively reduces the short-term load pressure of the server, improves the stability of the server, and avoids equipment business interruptions caused by restarts.
Smart Images

Figure CN119906750A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet of Things, and in particular to a method and apparatus, product, equipment and medium for processing network connections. Background Art
[0002] The Internet of Things is a network of physical devices that are connected and interact with each other through the Internet, enabling servers to collect data, remotely control, and intelligently manage devices.
[0003] In the related art, when a server is restarted based on the needs of update, maintenance, etc., it will disconnect all connected devices and restart again after the update or maintenance is completed. After the device is disconnected, it will re-initiate a connection request to the server. However, when the server is restarted, it is easy to cause excessive load pressure in a short period of time due to the need to process too many connection requests from devices, affecting the stability of the server. Summary of the invention
[0004] In view of the above problems, a method and apparatus, product, device, and medium for processing network connection are proposed to overcome the above problems or at least partially solve the above problems, including:
[0005] A method for processing a network connection, applied to a server, the method comprising:
[0006] In response to a restart requirement, obtaining restart time and connected device information;
[0007] Generate reconnection time information corresponding to each target device according to the connected device information and the restart time; wherein the reconnection time information is used for the target device to reconnect to the server according to the indication of the reconnection time information;
[0008] The reconnection time information is sent to the target device, and the network connection with the connected device is disconnected.
[0009] Optionally, the method further comprises:
[0010] In the case of completing the restart, determining a target device that has not received the reconnection time information;
[0011] Initiate a reconnection request to the target device that has not received the reconnection time information.
[0012] Optionally, determining the reconnection time information corresponding to each target device according to the connected device information and the restart time includes:
[0013] determining a plurality of first time ranges after the restart time;
[0014] According to the connected device information and the multiple first time ranges, the first time range corresponding to each target device is determined, and reconnection time information corresponding to each target device is generated.
[0015] Optionally, the method further comprises:
[0016] When the restart is completed, determining the reconnection failed device within each of the first time ranges;
[0017] Determine a second time range corresponding to each of the reconnection failure devices, and initiate a reconnection request to the reconnection failure devices within the second time range.
[0018] A method for processing a network connection, applied to a device, the method comprising:
[0019] Receiving reconnection time information sent by the server; wherein the reconnection time information is generated according to the restart time of the server;
[0020] When the network connection with the server is disconnected, reconnect to the server according to the instruction of the reconnection time information.
[0021] Optionally, the reconnection time information includes a first time range after the restart time, and the reconnecting to the server according to an instruction of the reconnection time information includes:
[0022] Reconnect to the server within the first time range according to the instruction of the reconnection time information.
[0023] Optionally, the method further comprises:
[0024] If the connection to the server cannot be successfully made within the first time range, determining a third time range;
[0025] Within the third time range, reconnect to the server.
[0026] A network connection processing device, applied to a server, comprising:
[0027] A restart information acquisition module, used to obtain restart time and connected device information in response to a restart requirement;
[0028] A reconnection time information generating module, configured to generate reconnection time information corresponding to each target device according to the connected device information and the restart time; wherein the reconnection time information is used by the target device to reconnect to the server according to the indication of the reconnection time information;
[0029] The reconnection time information sending module is used to send the reconnection time information to the target device and disconnect the network connection with the target device.
[0030] A network connection processing device, applied to a device, comprising:
[0031] A reconnection time information receiving module, used to receive the reconnection time information sent by the server; wherein the reconnection time information is generated according to the restart time of the server;
[0032] The reconnection processing module is used to reconnect to the server according to the indication of the reconnection time information when the network connection with the server is disconnected.
[0033] A computer program product, characterized in that it includes a computer program, which, when executed by a processor, implements the processing method for network connection applied to a server as described above, or the processing method for network connection applied to a server as described above.
[0034] An electronic device comprises a processor, a memory and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the processing method for network connection applied to a server as described above is implemented, or the processing method for network connection applied to a server as described above is implemented.
[0035] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the processing method for network connection applied to a server as described above, or the processing method for network connection applied to a server as described above.
[0036] The embodiments of the present invention have the following advantages: by responding to the need for restart, the restart time and the connected device information are obtained, and the reconnection time information corresponding to each target device is generated according to the connected device information and the restart time, wherein the reconnection time information is used for the target device to reconnect to the server according to the indication of the reconnection time information, the reconnection time information is sent to the target device, and the network connection with the connected device is disconnected, thereby reducing the short-term load pressure of the server and effectively improving the stability of the server. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solution of the present invention, the accompanying drawings required for use in the description of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0038] Figure 1 is a flowchart of a method for network processing applied to a server provided by an embodiment of the present invention;
[0039] Figure 2 is a flowchart of another method for network processing applied to a server provided by an embodiment of the present invention;
[0040] Figure 3 is a flowchart of another method for network processing applied to a server provided by an embodiment of the present invention;
[0041] Figure 4 is a flowchart of a method for network processing applied to a device provided by an embodiment of the present invention;
[0042] Figure 5 is a diagram of a network connection processing implementation process provided by an embodiment of the present invention;
[0043] Figure 6 is a structural block diagram of a network processing device applied to a server provided by an embodiment of the present invention;
[0044] Figure 7 is a structural block diagram of a network processing device applied to a device provided by an embodiment of the present invention;
[0045] Figure 8 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0046] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0047] The Internet of Things (IoT) refers to connecting various physical devices, sensors, actuators, etc. through the Internet to form a huge network, thereby realizing data interaction, remote control and intelligent management between devices. These devices can be household appliances, industrial equipment, transportation tools, medical equipment, etc. They are connected to the server through various communication protocols to realize data collection, transmission and processing.
[0048] In the IoT system, the server plays a core role, responsible for managing device connections, data storage and analysis, remote control command execution, etc. In order to ensure the stable operation of the server and the continuous update of its functions, the server needs to be maintained and updated regularly. However, when the server is restarted, all connected devices will be disconnected, resulting in a temporary interruption in the communication between the device and the server.
[0049] When the server is updated or maintained and restarted, all previously disconnected devices will try to reconnect to the server. Due to the large number of devices, a large number of devices will initiate connection requests to the server at the same time in a short period of time. This sudden peak of connection requests will bring huge load pressure to the server, which may cause the server to be unable to process all requests in a short period of time, thereby causing performance degradation, response delays, and even server crashes.
[0050] This excessive load pressure will not only affect the stability of the server, but may also cause the operating efficiency of the entire IoT system to decline, and even affect the business processes that rely on the system. For example, in the industrial IoT, device connection interruptions and reconnection delays may cause production lines to stop, affecting production efficiency; in smart home systems, device reconnection delays may cause users to be unable to control home appliances in a timely manner, affecting user experience.
[0051] Based on this, the present invention is based on the core idea of actively controlling the device to reconnect to the server, thereby reducing the short-term load pressure of the server and improving the stability of the server.
[0052] The embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0053] Reference Figure 1 , shows a flowchart of a method for processing a network connection provided by an embodiment of the present invention. The method for processing a network connection is applied to a server and may specifically include the following steps:
[0054] Step 101, in response to a restart requirement, obtaining restart time and connected device information;
[0055] The restart time refers to the scheduled time for the server to restart. For example, the server is scheduled to restart at a certain time after the current time.
[0056] Connected device information refers to the relevant information of the device that has established a network connection with the server, such as the device serial number, device model, etc.
[0057] Step 102, generating reconnection time information corresponding to each target device according to the connected device information and the restart time; wherein the reconnection time information is used by the target device to reconnect to the server according to the indication of the reconnection time information;
[0058] The target device refers to the device among the connected devices that needs to be reconnected according to the reconnection time information after the server is disconnected. Specifically, it can include all currently connected devices or some of the connected devices.
[0059] In a specific implementation, since all devices need to be disconnected before the server restarts, the reconnection time information may include an instruction for the target device to reconnect at a point in time or a time range after the server restart time. Different reconnection time information is generated for different target devices. This can avoid receiving a large number of reconnection requests from devices within a period of time after the server restarts, causing server load pressure or network bandwidth pressure.
[0060] In some embodiments of the present invention, determining the reconnection time information corresponding to each target device according to the connected device information and the restart time includes:
[0061] Sub-step 1021, determining a plurality of first time ranges after the restart time;
[0062] Exemplarily, the first time range can be a specific time range. For example, if the restart time is 15:00, the first time range can be 15:05-15:10, 15:10-15:15, etc.; it can also be a relative time range defined according to the restart time, such as within 5 to 10 minutes after the restart time, within 15 to 20 minutes after the restart time, etc. In this case, the restart time needs to be included in the restart time information.
[0063] In practical applications, the number and specific values of the first time ranges may be determined according to the number of target devices or according to actual needs. The multiple first time ranges may be discrete or continuous.
[0064] Sub-step 1022, determining the first time range corresponding to each target device according to the connected device information and the multiple first time ranges, and generating reconnection time information corresponding to each target device.
[0065] For example, assuming that 10 different first time ranges after the restart time are determined, and there are currently 100 target devices, the 10 target devices can be divided into the same first time range according to the principle of even distribution, and the corresponding reconnection time information is generated. After receiving the reconnection time information, these target devices will reconnect to the server within the allocated first time range.
[0066] In practical applications, after determining the first time range corresponding to each target device, the server may maintain multiple arrays or lists, each array or list corresponding to a first time range, for recording relevant information of each target device (such as device ID), specific value of the first time range, reconnection status, etc. When it is detected that the target device successfully reconnects to the server within its corresponding first time range, the reconnection status is updated, or the corresponding data is directly deleted, so as to track and maintain the device reconnection situation.
[0067] In actual applications, you can also obtain user usage of the target device (for example, whether there is a relevant user identification in a short period of time), device type and other information, sort the target devices, and assign devices with high reconnection priority to the first time range.
[0068] Step 103: Send the reconnection time information to the target device, and disconnect the network connection with the connected device.
[0069] In this embodiment, after the reconnection time information is sent to the target device, based on the need for server restart, the network connections of all devices currently connected to the server are disconnected. When the server restart is completed, different target devices will reconnect to the server according to the instructions of their corresponding reconnection time information. By actively controlling the reconnection time of the target device, it is possible to effectively avoid the problem of excessive short-term load pressure on the server caused by the target device sending a reconnection request to the server.
[0070] The embodiments of the present invention have the following advantages: by responding to the need for restart, the restart time and the connected device information are obtained, and the reconnection time information corresponding to each target device is generated according to the connected device information and the restart time, wherein the reconnection time information is used for the target device to reconnect to the server according to the indication of the reconnection time information, the reconnection time information is sent to the target device, and the network connection with the connected device is disconnected, thereby reducing the short-term load pressure of the server and effectively improving the stability of the server.
[0071] In some embodiments of the present invention, the method further comprises:
[0072] In the case of completing the restart, determining a target device that has not received the reconnection time information;
[0073] Initiate a reconnection request to the target device that has not received the reconnection time information.
[0074] In this embodiment, the target device may not be able to receive the reconnection time information due to power outages, network failures, etc. Therefore, after the server is restarted, the server needs to actively initiate a reconnection request to these target devices that have not received the reconnection time information, so that these target devices can reconnect to the server, thereby avoiding the original business interruption of the device due to the server restart.
[0075] In a specific implementation, whether the target device has successfully received the reconnection time information can be determined through the return information of the target device regarding the reconnection time information. If the target device returns a response indicating a reception failure, the server can mark it as a target device that has not received the reconnection time information.
[0076] In actual applications, the server can also maintain a device list of "unconfirmed connection status", which stores relevant information of devices that were connected before the restart but may not receive reconnection time information due to power outage. Furthermore, after the server completes the restart, it actively initiates a reconnection request to the devices in the "unconfirmed connection status" device list. At the same time, a limit can be added to the number of reconnection requests, and a certain waiting time (such as 5 minutes, etc.) can be set between each reconnection request. When the reconnection request is initiated more than the preset number of times (such as 3 times, 5 times), the device still cannot reconnect to the server, and then stops initiating reconnection requests; if the device has successfully reconnected, the relevant information of the device is removed from the "unconfirmed connection status" device list. In addition, before initiating a reconnection request, the status of these devices can be checked by sending heartbeat packets to find out whether they are powered on and running normally.
[0077] In some embodiments of the present invention, the method further comprises:
[0078] When the restart is completed, determining the reconnection failed device within each of the first time ranges;
[0079] Determine a second time range corresponding to each of the reconnection failure devices, and initiate a reconnection request to the reconnection failure devices within the second time range.
[0080] In this embodiment, after the server completes the restart, the target device may not be able to successfully reconnect to the server within the first time range indicated by the reconnection time information due to network failure, setting failure, etc. The server can retrieve these failed reconnection devices and determine the second time range corresponding to the failed reconnection devices, and initiate a reconnection request to the failed reconnection devices within the corresponding second time range.
[0081] For example, originally there are 100 target devices that need to initiate a reconnection request to the server within a certain time range A, but eventually 10 target devices cannot reconnect successfully within time range A, then these 10 target devices are reconnection failure devices. Then, the server determines a time range B again, and initiates a reconnection request to the reconnection failure devices within time range B. Similarly, a number limit can be added to the reconnection request, and a certain waiting time (such as 5 minutes, etc.) can be set between each reconnection request. When the reconnection request is initiated more than the preset number of times (such as 3 times, 5 times), the device still cannot reconnect to the server and stops initiating reconnection requests.
[0082] In actual applications, the server can record the reconnection status of the target device by maintaining an array or a list, which is "not connected" by default. When the target device successfully reconnects within the first time range, the reconnection status is updated to "connected". If the server detects that the target device is still "not connected" for a period of time exceeding the first time range, the target device can be determined as a reconnection failure device.
[0083] Reference Figure 2 , shows another method for processing a network connection provided in an embodiment of the present invention, the method for processing a network connection is applied to a server, and specifically may include the following steps:
[0084] Step 201, in response to a restart requirement, obtaining restart time and connected device information;
[0085] The restart time refers to the scheduled time for the server to restart. For example, the server is scheduled to restart at a certain time after the current time.
[0086] Connected device information refers to the relevant information of the device that has established a network connection with the server, such as the device serial number, device model, etc.
[0087] Step 202, determining a plurality of first time ranges after the restart time;
[0088] Step 203, determining the first time range corresponding to each target device according to the connected device information and the multiple first time ranges, and generating reconnection time information corresponding to each target device; wherein the reconnection time information is used for the target device to reconnect to the server according to the indication of the reconnection time information;
[0089] The target device refers to the device among the connected devices that needs to be reconnected according to the reconnection time information after the server is disconnected. Specifically, it can include all currently connected devices or some of the connected devices.
[0090] In a specific implementation, since all devices need to be disconnected before the server restarts, the reconnection time information may include an instruction for the target device to reconnect at a point in time or a time range after the server restart time. Different reconnection time information is generated for different target devices. This can avoid receiving a large number of reconnection requests from devices within a period of time after the server restarts, causing server load pressure or network bandwidth pressure.
[0091] Exemplarily, the first time range can be a specific time range. For example, if the restart time is 15:00, the first time range can be 15:05-15:10, 15:10-15:15, etc.; it can also be a relative time range defined according to the restart time, such as within 5 to 10 minutes after the restart time, within 15 to 20 minutes after the restart time, etc. In this case, the restart time needs to be included in the restart time information.
[0092] In practical applications, the number and specific values of the first time ranges may be determined according to the number of target devices or according to actual needs. The multiple first time ranges may be discrete or continuous.
[0093] For example, assuming that 10 different first time ranges after the restart time are determined, and there are currently 100 target devices, the 10 target devices can be divided into the same first time range according to the principle of even distribution, and the corresponding reconnection time information is generated. After receiving the reconnection time information, these target devices will reconnect to the server within the allocated first time range.
[0094] In practical applications, after determining the first time range corresponding to each target device, the server may maintain multiple arrays or lists, each array or list corresponding to a first time range, for recording relevant information of each target device (such as device ID), specific value of the first time range, reconnection status, etc. When it is detected that the target device successfully reconnects to the server within its corresponding first time range, the reconnection status is updated, or the corresponding data is directly deleted, so as to track and maintain the device reconnection situation.
[0095] In actual applications, you can also obtain user usage of the target device (for example, whether there is a relevant user identification in a short period of time), device type and other information, sort the target devices, and assign devices with high reconnection priority to the first time range.
[0096] Step 204: Send the reconnection time information to the target device, and disconnect the network connection with the connected device.
[0097] After the reconnection time information is sent to the target device, based on the server restart requirement, the network connection of all devices currently connected to the server is disconnected. When the server restart is complete, different target devices will reconnect to the server according to the instructions of their corresponding reconnection time information. By actively controlling the reconnection time of the target device, it is possible to effectively avoid the problem of excessive short-term load pressure on the server caused by the target device sending a reconnection request to the centralized server.
[0098] Step 205, when the restart is completed, determining the reconnection failed devices within each of the first time ranges;
[0099] Step 206: determine a second time range corresponding to each of the reconnection failure devices, and initiate a reconnection request to the reconnection failure devices within the second time range.
[0100] After the server completes the restart, the target device may not be able to successfully reconnect to the server within the first time range indicated by the reconnection time information due to network failure, setting failure, etc. The server can retrieve these failed reconnection devices, determine the second time range corresponding to the failed reconnection devices, and initiate a reconnection request to the failed reconnection devices within the corresponding second time range.
[0101] For example, originally there are 100 target devices that need to initiate a reconnection request to the server within a certain time range A, but eventually 10 target devices cannot reconnect successfully within time range A, then these 10 target devices are reconnection failure devices. Then, the server determines a time range B again, and initiates a reconnection request to the reconnection failure devices within time range B. Similarly, a number limit can be added to the reconnection request, and a certain waiting time (such as 5 minutes, etc.) can be set between each reconnection request. When the reconnection request is initiated more than the preset number of times (such as 3 times, 5 times), the device still cannot reconnect to the server and stops initiating reconnection requests.
[0102] In actual applications, the server can record the reconnection status of the target device by maintaining an array or a list, which is "not connected" by default. When the target device successfully reconnects within the first time range, the reconnection status is updated to "connected". If the server detects that the target device is still "not connected" for a period of time exceeding the first time range, the target device can be determined as a reconnection failure device.
[0103] Reference Figure 3 , shows another method for processing a network connection provided in an embodiment of the present invention, the method for processing a network connection is applied to a server, and specifically may include the following steps:
[0104] Step 301, in response to a restart requirement, obtaining restart time and connected device information;
[0105] The restart time refers to the scheduled time for the server to restart. For example, the server is scheduled to restart at a certain time after the current time.
[0106] Connected device information refers to the relevant information of the device that has established a network connection with the server, such as the device serial number, device model, etc.
[0107] Step 302: Generate reconnection time information corresponding to each target device according to the connected device information and the restart time; wherein the reconnection time information is used by the target device to reconnect to the server according to the indication of the reconnection time information.
[0108] The target device refers to the device among the connected devices that needs to be reconnected according to the reconnection time information after the server is disconnected. Specifically, it can include all currently connected devices or some of the connected devices.
[0109] In a specific implementation, since all devices need to be disconnected before the server restarts, the reconnection time information may include an instruction for the target device to reconnect at a point in time or a time range after the server restart time. Different reconnection time information is generated for different target devices. This can avoid receiving a large number of reconnection requests from devices within a period of time after the server restarts, causing server load pressure or network bandwidth pressure.
[0110] Step 303: Send the reconnection time information to the target device, and disconnect the network connection with the connected device.
[0111] In this embodiment, after the reconnection time information is sent to the target device, based on the need for server restart, the network connection of all devices currently connected to the server is disconnected. When the server restart is complete, different target devices will reconnect to the server according to the instructions of their corresponding reconnection time information. By actively controlling the reconnection time of the target device, it is possible to effectively avoid the problem of excessive short-term load pressure on the server caused by the target device sending a reconnection request to the server.
[0112] Step 304, when the restart is completed, determining the target device that has not received the reconnection time information;
[0113] In this embodiment, the target device may not be able to receive the reconnection time information due to power outages, network failures, etc. Therefore, after the server is restarted, the server needs to actively initiate a reconnection request to these target devices that have not received the reconnection time information, so that these target devices can reconnect to the server, thereby avoiding the original business interruption of the device due to the server restart.
[0114] In a specific implementation, whether the target device has successfully received the reconnection time information can be determined through the return information of the target device regarding the reconnection time information. If the target device returns a response indicating a reception failure, the server can mark it as a target device that has not received the reconnection time information.
[0115] Step 305: Initiate a reconnection request to the target device that has not received the reconnection time information.
[0116] In actual applications, the server can also maintain a device list of "unconfirmed connection status", which stores relevant information of devices that were connected before the restart but may not receive reconnection time information due to power outage. Furthermore, after the server completes the restart, it actively initiates a reconnection request to the devices in the "unconfirmed connection status" device list. At the same time, a limit can be added to the number of reconnection requests, and a certain waiting time (such as 5 minutes, etc.) can be set between each reconnection request. When the reconnection request is initiated more than the preset number of times (such as 3 times, 5 times), the device still cannot reconnect to the server, and then stops initiating reconnection requests; if the device has successfully reconnected, the relevant information of the device is removed from the "unconfirmed connection status" device list. In addition, before initiating a reconnection request, the status of these devices can be checked by sending heartbeat packets to find out whether they are powered on and running normally.
[0117] Reference Figure 4 , shows a flowchart of a method for processing a network connection provided by an embodiment of the present invention, the method for processing a network connection is applied to a device, and specifically may include the following steps:
[0118] Step 401, receiving reconnection time information sent by a server; wherein the reconnection time information is generated according to the restart time of the server;
[0119] Exemplarily, the reconnection time information may include an instruction for the target device to reconnect at a time point or a time range after the restart time of the server.
[0120] Step 402: When the network connection with the server is disconnected, reconnect to the server according to the instruction of the reconnection time information.
[0121] In actual applications, when the device that receives the reconnection time information loses its network connection with the server, the device does not immediately try to reconnect to the server, but enters a waiting state and reconnects according to the instructions of the reconnection time information. When the device detects that the current time meets the instructions of the reconnection time information, it initiates a reconnection request to the server. When a connection is successfully established with the server, normal communication is resumed.
[0122] In some embodiments of the present invention, the reconnection time information includes a first time range after the restart time, and reconnecting to the server according to an instruction of the reconnection time information includes:
[0123] Reconnect to the server within the first time range according to the instruction of the reconnection time information.
[0124] In this embodiment, the device reconnects to the server within the first time range according to the indication of the reconnection time information. Since the reconnection time information received by different devices may be different, that is, the first time range is also different, the device cooperates with the server to reconnect, which can avoid a large number of devices from concentratedly initiating reconnection requests to the server, causing an increase in the short-term load pressure on the server.
[0125] In actual applications, a limit can be added to the number of times the device sends reconnection requests to the server within the first time range, and a certain waiting time (such as 5 minutes, etc.) can be set between each reconnection. When the device initiates reconnection requests exceeding the preset number of times (such as 3 times, 5 times), or the current time has exceeded the first time range, and the device still cannot reconnect to the server, it stops sending reconnection requests to the server.
[0126] In some embodiments of the present invention, the method further comprises:
[0127] If the connection to the server cannot be successfully made within the first time range, determining a third time range;
[0128] Within the third time range, reconnect to the server.
[0129] In this embodiment, the device may still fail to successfully connect to the server within the first time range due to its own failure, network failure, etc., so the device can re-specify a third time range and re-initiate a connection to the server within the third time range until success.
[0130] In practical applications, an exponential backoff strategy may be used for reconnection, that is, within the third time range, each time a reconnection fails, another attempt is made after waiting for a period of time, and each waiting time increases exponentially.
[0131] In some embodiments of the present invention, Figure 5 As shown, an implementation process of network connection processing combined with actual business scenarios is also provided, which is as follows:
[0132] 1) The server enters the restart process;
[0133] 2) Server startup script, ready to restart or update services;
[0134] 3) The server discretizes all connected devices into n time slices and maintains n arrays, each time array corresponds to a device that needs to reconnect within a time slice;
[0135] 4) Send information to the connected device, informing it of the time slot at which it needs to reconnect;
[0136] 5) If the device fails to reconnect, it will generate a discrete time slice and actively initiate reconnection when the time reaches the time slice; if the device is powered off and cannot reconnect successfully, the server will randomly generate a time slice to actively connect to the device;
[0137] 6) The device is reconnected.
[0138] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0139] Reference Figure 6 , shows a schematic diagram of the structure of a network connection processing device provided by an embodiment of the present invention, which is applied to a server and may specifically include the following modules:
[0140] Restart information acquisition module 601, used to obtain restart time and connected device information in response to the restart requirement;
[0141] A reconnection time information generating module 602 is used to generate reconnection time information corresponding to each target device according to the connected device information and the restart time; wherein the reconnection time information is used for the target device to reconnect to the server according to the indication of the reconnection time information;
[0142] The reconnection time information sending module 603 is used to send the reconnection time information to the target device and disconnect the network connection with the target device.
[0143] In some embodiments of the present invention, the device further comprises:
[0144] A non-receiving device determining module, used to determine a target device that has not received the reconnection time information when the restart is completed;
[0145] The first reconnection request initiating module is used to initiate a reconnection request to the target device that has not received the reconnection time information.
[0146] In some embodiments of the present invention, the reconnection time information generating module 602 includes:
[0147] A first time range determination submodule, used to determine a plurality of first time ranges after the restart time;
[0148] According to the connected device information and the multiple first time ranges, the first time range corresponding to each target device is determined, and reconnection time information corresponding to each target device is generated.
[0149] In some embodiments of the present invention, the device further comprises:
[0150] A reconnection failure device determination module, used to determine the reconnection failure device within each of the first time ranges when the restart is completed;
[0151] The second reconnection request initiating module determines a second time range corresponding to each of the reconnection failure devices, and initiates a reconnection request to the reconnection failure devices within the second time range.
[0152] Reference Figure 7 , shows a schematic diagram of the structure of a network connection processing device provided by an embodiment of the present invention, which is applied to a device and may specifically include the following modules:
[0153] The reconnection time information receiving module 701 is used to receive the reconnection time information sent by the server; wherein the reconnection time information is generated according to the restart time of the server;
[0154] The reconnection processing module 702 is used to reconnect to the server according to the indication of the reconnection time information when the network connection with the server is disconnected.
[0155] In some embodiments of the present invention, the reconnection time information includes a first time range after the restart time, and the reconnection processing module 702 includes:
[0156] The reconnection processing submodule is used to reconnect to the server within the first time range according to the indication of the reconnection time information.
[0157] In some embodiments of the present invention, the device further comprises:
[0158] A third time range determination module, configured to determine a third time range if the connection to the server cannot be successfully made within the first time range;
[0159] A third time range reconnection processing module is configured to reconnect to the server within the third time range.
[0160] In some embodiments of the present invention, Figure 8 As shown, it includes a processor 801, a communication interface 802, a memory 803 and a communication bus 804, wherein the processor 801, the communication interface 802, and the memory 803 communicate with each other through the communication bus 804.
[0161] Memory 803, used for storing computer programs;
[0162] The processor 801 is used to execute the program stored in the memory 803, and implements the following steps:
[0163] In response to a restart requirement, obtaining restart time and connected device information;
[0164] Generate reconnection time information corresponding to each target device according to the connected device information and the restart time; wherein the reconnection time information is used for the target device to reconnect to the server according to the indication of the reconnection time information;
[0165] The reconnection time information is sent to the target device, and the network connection with the connected device is disconnected.
[0166] In some embodiments of the present invention, it also includes:
[0167] In the case of completing the restart, determining a target device that has not received the reconnection time information;
[0168] Initiate a reconnection request to the target device that has not received the reconnection time information.
[0169] In some embodiments of the present invention, determining the reconnection time information corresponding to each target device according to the connected device information and the restart time includes:
[0170] determining a plurality of first time ranges after the restart time;
[0171] According to the connected device information and the multiple first time ranges, the first time range corresponding to each target device is determined, and reconnection time information corresponding to each target device is generated.
[0172] In some embodiments of the present invention, it also includes:
[0173] When the restart is completed, determining the reconnection failed device within each of the first time ranges;
[0174] Determine a second time range corresponding to each of the reconnection failure devices, and initiate a reconnection request to the reconnection failure devices within the second time range.
[0175] Alternatively, implement the following steps:
[0176] Receiving reconnection time information sent by the server; wherein the reconnection time information is generated according to the restart time of the server;
[0177] When the network connection with the server is disconnected, reconnect to the server according to the instruction of the reconnection time information.
[0178] In some embodiments of the present invention, the reconnection time information includes a first time range after the restart time, and reconnecting to the server according to an instruction of the reconnection time information includes:
[0179] Reconnect to the server within the first time range according to the instruction of the reconnection time information.
[0180] In some embodiments of the present invention, it also includes:
[0181] If the connection to the server cannot be successfully made within the first time range, determining a third time range;
[0182] Within the third time range, reconnect to the server.
[0183] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0184] The communication interface is used for communication between the above terminal and other devices.
[0185] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0186] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0187] Some embodiments of the present invention further provide a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0188] In response to a restart requirement, obtaining restart time and connected device information;
[0189] Generate reconnection time information corresponding to each target device according to the connected device information and the restart time; wherein the reconnection time information is used for the target device to reconnect to the server according to the indication of the reconnection time information;
[0190] The reconnection time information is sent to the target device, and the network connection with the connected device is disconnected.
[0191] In some embodiments of the present invention, it also includes:
[0192] In the case of completing the restart, determining a target device that has not received the reconnection time information;
[0193] Initiate a reconnection request to the target device that has not received the reconnection time information.
[0194] In some embodiments of the present invention, determining the reconnection time information corresponding to each target device according to the connected device information and the restart time includes:
[0195] determining a plurality of first time ranges after the restart time;
[0196] According to the connected device information and the multiple first time ranges, the first time range corresponding to each target device is determined, and reconnection time information corresponding to each target device is generated.
[0197] In some embodiments of the present invention, it also includes:
[0198] When the restart is completed, determining the reconnection failed device within each of the first time ranges;
[0199] Determine a second time range corresponding to each of the reconnection failure devices, and initiate a reconnection request to the reconnection failure devices within the second time range.
[0200] Alternatively, implement the following steps:
[0201] Receiving reconnection time information sent by the server; wherein the reconnection time information is generated according to the restart time of the server;
[0202] When the network connection with the server is disconnected, reconnect to the server according to the instruction of the reconnection time information.
[0203] In some embodiments of the present invention, the reconnection time information includes a first time range after the restart time, and reconnecting to the server according to an instruction of the reconnection time information includes:
[0204] Reconnect to the server within the first time range according to the instruction of the reconnection time information.
[0205] In some embodiments of the present invention, it also includes:
[0206] If the connection to the server cannot be successfully made within the first time range, determining a third time range;
[0207] Within the third time range, reconnect to the server.
[0208] Some embodiments of the present invention further provide a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0209] In response to a restart requirement, obtaining restart time and connected device information;
[0210] Generate reconnection time information corresponding to each target device according to the connected device information and the restart time; wherein the reconnection time information is used for the target device to reconnect to the server according to the indication of the reconnection time information;
[0211] The reconnection time information is sent to the target device, and the network connection with the connected device is disconnected.
[0212] In some embodiments of the present invention, it also includes:
[0213] In the case of completing the restart, determining a target device that has not received the reconnection time information;
[0214] Initiate a reconnection request to the target device that has not received the reconnection time information.
[0215] In some embodiments of the present invention, determining the reconnection time information corresponding to each target device according to the connected device information and the restart time includes:
[0216] determining a plurality of first time ranges after the restart time;
[0217] According to the connected device information and the multiple first time ranges, the first time range corresponding to each target device is determined, and reconnection time information corresponding to each target device is generated.
[0218] In some embodiments of the present invention, it also includes:
[0219] When the restart is completed, determining the reconnection failed device within each of the first time ranges;
[0220] Determine a second time range corresponding to each of the reconnection failure devices, and initiate a reconnection request to the reconnection failure devices within the second time range.
[0221] Alternatively, implement the following steps:
[0222] Receiving reconnection time information sent by the server; wherein the reconnection time information is generated according to the restart time of the server;
[0223] When the network connection with the server is disconnected, reconnect to the server according to the instruction of the reconnection time information.
[0224] In some embodiments of the present invention, the reconnection time information includes a first time range after the restart time, and reconnecting to the server according to an instruction of the reconnection time information includes:
[0225] Reconnect to the server within the first time range according to the instruction of the reconnection time information.
[0226] In some embodiments of the present invention, it also includes:
[0227] If the connection to the server cannot be successfully made within the first time range, determining a third time range;
[0228] Within the third time range, reconnect to the server.
[0229] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0230] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0231] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0232] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0233] Those skilled in the art will appreciate that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0234] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0235] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0236] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0237] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0238] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the above elements.
[0239] The network connection processing method, device, product, equipment, and medium provided above are introduced in detail. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for processing a network connection, characterized in that: Applied to a server, the method comprises: In response to a restart requirement, obtaining restart time and connected device information; Generate reconnection time information corresponding to each target device according to the connected device information and the restart time; wherein the reconnection time information is used for the target device to reconnect to the server according to the indication of the reconnection time information; The reconnection time information is sent to the target device, and the network connection with the connected device is disconnected.
2. The method according to claim 1, characterized in that The method further comprises: In the case of completing the restart, determining a target device that has not received the reconnection time information; Initiate a reconnection request to the target device that has not received the reconnection time information.
3. The method according to claim 1 or 2, characterized in that: The determining, according to the connected device information and the restart time, the reconnection time information corresponding to each target device includes: determining a plurality of first time ranges after the restart time; According to the connected device information and the multiple first time ranges, the first time range corresponding to each target device is determined, and reconnection time information corresponding to each target device is generated.
4. The method according to claim 3, characterized in that The method further comprises: When the restart is completed, determining the reconnection failed device within each of the first time ranges; Determine a second time range corresponding to each of the reconnection failure devices, and initiate a reconnection request to the reconnection failure devices within the second time range.
5. A method for processing a network connection, characterized in that: Applied to a device, the method comprises: Receiving reconnection time information sent by the server; wherein the reconnection time information is generated according to the restart time of the server; When the network connection with the server is disconnected, reconnect to the server according to the instruction of the reconnection time information.
6. The method according to claim 5, characterized in that The reconnection time information includes a first time range after the restart time, and the reconnecting to the server according to an instruction of the reconnection time information includes: Reconnect to the server within the first time range according to the instruction of the reconnection time information.
7. The method according to claim 6, characterized in that The method further comprises: If the connection to the server cannot be successfully made within the first time range, determining a third time range; Within the third time range, reconnect to the server.
8. A network connection processing device, characterized in that: Applied to a server, the device comprises: A restart information acquisition module, used to obtain restart time and connected device information in response to a restart requirement; A reconnection time information generating module, configured to generate reconnection time information corresponding to each target device according to the connected device information and the restart time; wherein the reconnection time information is used by the target device to reconnect to the server according to the indication of the reconnection time information; The reconnection time information sending module is used to send the reconnection time information to the target device and disconnect the network connection with the target device.
9. A network connection processing device, characterized in that: Applied to equipment, the device comprises: A reconnection time information receiving module, used to receive the reconnection time information sent by the server; wherein the reconnection time information is generated according to the restart time of the server; The reconnection processing module is used to reconnect to the server according to the indication of the reconnection time information when the network connection with the server is disconnected.
10. A computer program product, characterized in that The invention comprises a computer program, which, when executed by a processor, implements the method for processing a network connection as claimed in any one of claims 1 to 4, or the method for processing a network connection as claimed in any one of claims 5 to 7.
11. An electronic device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the method for processing a network connection as described in any one of claims 1 to 4 or the method for processing a network connection as described in any one of claims 5 to 7 is implemented.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for processing a network connection as described in any one of claims 1 to 4, or the method for processing a network connection as described in any one of claims 5 to 7 is implemented.
Citation Information
Patent Citations
Processing method for emergency request, terminal, and computer-readable storage medium
CN107666513A
Long connection recovery method, system and device, electronic equipment and storage medium
CN111193769A
Connection establishment method and device, equipment and storage medium
CN115051956A
Network reconnection method and device, terminal equipment and storage medium
CN116939000A
Connection method of server, server, storage medium and electronic equipment
CN119109962A