Communication fault processing method and device, equipment and storage medium
By regularly sending keep-alive data and monitoring the connection status between the client and the server, automatic and non-aware communication recovery is realized, which solves the problem of service interruption in the existing technology and improves the stability of the service and the connection efficiency.
Patent Information
- Application Number
- CN202310171478.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-23
- Publication Date
- 2024-08-23
AI Technical Summary
Existing communication fault detection and repair solutions cannot achieve automatic and imperceptible reconnection when data transmission fails between the server and the client, resulting in service interruption and reduced stability.
By regularly sending keep-alive data between the client and the server, monitoring the data transmission status, and automatically sending reconnection requests or creating new connection requests based on the underlying communication connection status, achieving uninterrupted communication recovery.
It improves service stability and user experience, avoids service interruptions, reduces reconnection failures and information authentication and verification processes, and improves connection efficiency.
Smart Images

Figure CN118540209A
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a communication failure processing method, device, equipment and storage medium. Background Art
[0002] Currently, the operating system supports the installation of clients that provide different functional services. The client renders and displays on the front end based on the data provided by the backend server. For example, when KVM (Keyboard Video Mouse) is installed in BMC (Baseboard Management Controller), it can control the remote server. The client obtains the video data in the server from the backend server and renders and displays it on the front end page. In this case, the client needs to establish a communication connection with the server for data transmission.
[0003] The stability of various functional services is crucial, affecting the normal operation of services and user experience. Fault detection and repair of services affect the stability of functional services, so fault detection and repair of services play a key role.
[0004] The current fault detection and repair scheme, for example, is: if the service operation is detected to be abnormal, a prompt is given through the client to inform the user of the service abnormality and restart the service, but this scheme will interrupt the ongoing operation and service and cannot achieve self-recovery. There is also a fault detection and repair scheme: create a monitoring process or thread, monitor the service status in real time, and restart the service periodically in the background. This scheme can periodically release system resources and restore the service status, but it will still interrupt the service. Summary of the invention
[0005] The present application provides a communication failure processing method, apparatus, device and storage medium, so as to automatically reconnect without interrupting the service when a communication connection between a client and a server fails, thereby improving the stability of the service.
[0006] In a first aspect, the present application provides a communication failure processing method, which is applied to a client, and the method includes:
[0007] Sending keep-alive data to the server at a preset frequency, and the server feeding back confirmation information to the client in response to the keep-alive data;
[0008] If it is determined that the data transmission between the client and the server is abnormal according to the confirmation information feedback of the server, then determining the underlying communication connection state;
[0009] According to the underlying communication connection status, a communication connection request is sent to the server to establish a communication connection with the server.
[0010] The above technical solution uses keep-alive data to quickly and directly determine whether data transmission can be carried out normally between the client and the server. When data transmission cannot be carried out, a connection request is sent to the server to establish a communication connection based on the underlying communication connection status. In this way, the communication connection is automatically and imperceptibly reestablished without interrupting the services provided by the client, thereby improving the stability of the service.
[0011] Optionally, sending a communication connection request to the server according to the underlying communication connection state includes:
[0012] If the underlying communication connection state is interrupted, sending a request to the server to create a new communication connection, so as to re-establish a new communication connection with the server;
[0013] If the underlying communication connection state is connected, a reconnection request for the current communication connection is sent to the server, so as to reconnect with the server based on the current communication connection.
[0014] The above technical solution determines the underlying communication connection status, and when the underlying communication connection status is interrupted, promptly sends a request to create a new communication connection to achieve reconnection with the server and avoid reconnection failure. When the underlying communication connection status is connected, a reconnection request for the current communication connection is sent, thereby eliminating the process of re-authentication of information and token verification, improving the connection efficiency and ensuring the stability of the service.
[0015] Optionally, determine the underlying communication connection status, including:
[0016] If a prompt message indicating that the underlying communication connection is disconnected is detected, the underlying communication connection state is determined to be interrupted; wherein the prompt message is generated when the underlying communication connection is detected to be disconnected;
[0017] If no prompt information indicating that the underlying communication connection is disconnected is detected, it is determined that the underlying communication connection state is connected.
[0018] The above technical solution monitors the prompt information generated when the underlying communication connection is disconnected, accurately judges the status of the underlying communication connection, and then adaptively determines the connection method, thereby improving the efficiency of the connection and solving the problem of directly creating a new connection when the status of the underlying communication connection is uncertain, which requires cumbersome information authentication and token verification processes to be re-performed.
[0019] Optionally, determining that data transmission between the client and the server is abnormal according to confirmation information feedback from the server includes:
[0020] If the confirmation information of the server in response to the keep-alive data feedback is not received within a preset time, it is determined that the data transmission between the client and the server is abnormal; wherein the preset time is greater than the interval between two consecutive sending of keep-alive data.
[0021] The above technical solution improves the accuracy of transmission anomaly judgment by setting a preset time for verifying the reception of confirmation information, and avoids the situation where misjudgment is caused by identifying data transmission anomaly due to accidental failure to receive confirmation information.
[0022] In a second aspect, the present application provides a communication failure processing method, which is applied to a server, and the method includes:
[0023] receiving keep-alive data sent by a client at a preset frequency, and feeding back confirmation information to the client in response to the keep-alive data;
[0024] If abnormal data transmission between the server and the client is determined according to the keep-alive data sending status of the client, the fault is repaired according to the fault detection result.
[0025] The above technical solution can timely monitor whether data transmission between the client and the server can be carried out normally by receiving the client's keep-alive data, and perform fault repair in time when data transmission cannot be carried out to ensure the stability of the service, and confirm the information through response feedback so that the client can timely determine whether data transmission between the client and the server can be carried out normally.
[0026] Optionally, the method further includes:
[0027] Receiving a communication connection request sent by the client;
[0028] Establishing a communication connection with the client according to the communication connection request.
[0029] The above technical solution responds to the communication connection request sent by the client, so as to promptly restore data transmission with the client when the client and the server cannot transmit data, thereby achieving imperceptible reconnection without interrupting the service and ensuring the normal operation of the service.
[0030] Optionally, establishing a communication connection with the client according to the communication connection request includes:
[0031] If a request for creating a new communication connection is received from the client, a communication connection is established with the client, and information authentication and token verification are performed on the client;
[0032] Clear the session information corresponding to the original communication connection, and create the session information corresponding to the new communication connection;
[0033] If a reconnection request for the current communication connection sent by the client is received, a communication connection is established with the client directly through the reconnection request.
[0034] The above technical solution distinguishes the connection requests sent by the client and adaptively determines whether to create a new connection or continue to connect to the original communication link, so as to reconnect based on the current communication connection when the underlying link is not disconnected, eliminating the process of information authentication and token verification, improving connection efficiency, and re-establishing a new connection when the underlying link is disconnected to ensure the successful execution of the reconnection, thereby ensuring the stability of the service.
[0035] Optionally, repair the fault according to the fault detection result, including:
[0036] Detecting at least one fault respectively through at least one thread, and updating fault status data according to the fault detection result;
[0037] The fault is repaired according to the fault status data.
[0038] The above technical solution detects faults in a timely manner, thereby quickly locking the faults and analyzing the causes of the faults, making it easier to repair the faults in a timely manner, and solving the problem that the client and the server cannot transmit data normally again due to the fault after reconnecting. In addition, at least one fault is detected in parallel through at least one thread, thereby improving the fault detection efficiency and detecting the faults in a timely and rapid manner.
[0039] Optionally, repairing the fault according to the fault status data includes:
[0040] Determine the fault repair method corresponding to the fault state data according to the correspondence between the preset fault state data and the encapsulated preset fault repair method;
[0041] Based on the fault status method, the fault is repaired.
[0042] The above technical solution encapsulates the preset fault repair method in advance and establishes a corresponding relationship between the preset fault status data and the encapsulated preset fault repair method, so as to quickly call the corresponding fault repair method according to the fault status data to repair the fault, thereby improving the efficiency of fault repair.
[0043] In a third aspect, the present application provides a communication failure processing device, which is applied to an electronic device corresponding to a client, and the device includes:
[0044] A keep-alive data sending module, used for sending keep-alive data to the server at a preset frequency, and the server feeds back confirmation information to the client in response to the keep-alive data;
[0045] A status determination module, configured to determine the underlying communication connection status if it is determined that data transmission between the client and the server is abnormal according to the confirmation information feedback of the server;
[0046] The request sending module is used to send a communication connection request to the server according to the underlying communication connection status, so as to establish a communication connection with the server.
[0047] In a fourth aspect, the present application provides a communication fault processing device, which is applied to an electronic device corresponding to a server, and the device includes:
[0048] A keep-alive data receiving module, configured to receive keep-alive data sent by a client at a preset frequency, and feed back confirmation information to the client in response to the keep-alive data;
[0049] The fault repair module is used to repair the fault according to the fault detection result if abnormal data transmission between the server and the client is determined according to the keep-alive data sending status of the client.
[0050] In a fifth aspect, the present application provides an electronic device, the device comprising:
[0051] at least one processor; and
[0052] a memory communicatively connected to at least one processor; wherein,
[0053] The memory stores a computer program that can be executed by at least one processor, and the computer program is executed by at least one processor so that the at least one processor can execute the communication fault handling method applied to the client provided in the first aspect of the present application, or execute the communication fault handling method applied to the server provided in the second aspect of the present application.
[0054] In a sixth aspect, a computer-readable storage medium is provided, which stores computer instructions, and the computer instructions are used to enable a processor to execute the communication fault handling method applied to the client provided in the first aspect of the present application, or to execute the communication fault handling method applied to the server provided in the second aspect of the present application.
[0055] The technical solution of the embodiment of the present application, when applied to the client, includes: sending keep-alive data to the server at a preset frequency, and the server feeding back confirmation information to the client in response to the keep-alive data; if it is determined that the data transmission between the client and the server is abnormal according to the confirmation information feedback of the server, then determining the underlying communication connection status; according to the underlying communication connection status, sending a communication connection request to the server to establish a communication connection with the server. This technical solution quickly and directly determines whether data transmission can be carried out normally between the client and the server through keep-alive data. When data transmission cannot be carried out, a connection request is sent to the server according to the underlying communication connection status to establish a communication connection, thereby automatically and imperceptibly reconnecting the communication without interrupting the service provided by the client, thereby improving the stability of the service.
[0056] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0058] Figure 1 A flowchart of a communication failure processing method applied to a client provided in Embodiment 1 of the present application;
[0059] Figure 2 A flowchart of another communication failure processing method applied to a client provided in Embodiment 2 of the present application;
[0060] Figure 3 A flowchart of the client-server connection process provided in Embodiment 2 of the present application;
[0061] Figure 4 A flowchart of a communication failure handling method applied to a server provided in Embodiment 3 of the present application;
[0062] Figure 5 A flowchart of another communication failure processing method applied to a server provided in Embodiment 4 of the present application;
[0063] Figure 6 A flow chart of the server operation process provided in Example 4 of the present application;
[0064] Figure 7A complete flowchart of a specific implementation of a communication fault handling method provided in Embodiment 5 of the present application;
[0065] Figure 8 A signaling diagram of a communication fault handling method provided in Embodiment 5 of the present application;
[0066] Fig. 9 A flow chart of the reconnection mechanism provided in Embodiment 5 of the present application;
[0067] Fig.10 A schematic diagram of the structure of a communication fault handling device provided in Embodiment 6 of the present application;
[0068] Fig.11 A schematic diagram of the structure of a communication fault handling device provided in Embodiment 7 of the present application;
[0069] Fig.12 This is a schematic diagram of the structure of an electronic device according to Embodiment 8 of the present application. DETAILED DESCRIPTION
[0070] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.
[0071] It should be noted that the terms "first", "second", "target", "candidate", "to be assigned", "to be processed", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0072] Embodiment 1
[0073] Figure 1This is a flowchart of a communication fault processing method applied to a client provided in Embodiment 1 of the present application. This embodiment can be applied to the case where the communication connection between the client and the server is detected and reconnected. The method can be executed by a communication fault processing device applied to the client. The communication fault processing device can be implemented in the form of hardware and / or software. The communication fault processing device can be configured in an electronic device. Figure 1 As shown, the method is applied to the client and includes:
[0074] S110 , sending keep-alive data to the server at a preset frequency, and the server feeding back confirmation information to the client in response to the keep-alive data.
[0075] Among them, the preset frequency can be determined according to actual conditions, for example, it can be set to once every 3 seconds. The client can be a client that can provide services, for example, it can be a remote control client. When the client is a remote control client, it can be a KVM client, a Sunflower client, etc. The client can be installed on an operating system, for example, a KVM client can be installed in a BMC operating system. The server can be a background server corresponding to the client service. The keep-alive data can be a network message composed of a header and a body, the content of which is not limited, and can be a specified content agreed upon in advance by the client and the server. The confirmation information can also be a network message composed of a header and a body, the content of which is also not limited, and can be a specified content agreed upon in advance by the client and the server.
[0076] Exemplarily, the client can send keep-alive data to the server at a preset frequency, for example, sending keep-alive data to the server once every 3 seconds. The client can also send keep-alive data to the server at a preset frequency within a preset time period according to a preset time. The client can also adaptively adjust the frequency of sending keep-alive data to the server. For example, if it is detected that the client and the server cannot transmit data according to the keep-alive data, the frequency of sending keep-alive data is increased. If it is not detected that the client and the server cannot transmit data within the preset time period, the frequency of sending keep-alive data can be reduced to reduce power consumption. After receiving the keep-alive data, the server feeds back confirmation information to the client. The server can immediately feed back confirmation information after receiving the keep-alive data sent by the client. The delay time can be set. The delay time is less than the time interval from the server receiving the keep-alive data to the next time the client sends the keep-alive data. After receiving the keep-alive data sent by the client and after the delay time, the confirmation information is fed back to the client to detect the communication connection status near the middle time of the two keep-alive data sending intervals through the confirmation information. If the server does not receive the keep-alive data, it will not send confirmation information to the client, and the client will not receive the confirmation information from the server. Similarly, if the communication connection between the client and the server fails, the server will not receive the keep-alive data sent by the client.
[0077] The above solution uses keep-alive data to timely detect whether the client and the server can transmit data normally, and intuitively reflects the communication status between the client and the server, so that when it is detected that the client and the server cannot transmit data, timely reconnection can be carried out to ensure the normal operation of the service.
[0078] S120: If it is determined that the data transmission between the client and the server is abnormal according to the confirmation information feedback from the server, determine the underlying communication connection status.
[0079] Among them, the form of communication connection between the client and the server is not limited, for example, it can be a WebSocket connection, a Socket connection, an HTTP connection, etc. The specific form can be determined by the development form of the client. If the page of the client is based on Java development, a Socket connection can be established. If the page of the client is based on Html5 development, a WebSocket connection can be established. In an embodiment of the present application, the client can determine whether the data transmission between the client and the server is abnormal based on the confirmation information feedback of the server. For example, if the client does not receive the confirmation information fed back by the server, it can be determined that the data transmission between the client and the server is abnormal, and the specific judgment method can be pre-set according to the actual situation. The abnormal data transmission between the client and the server may be caused by a failure of the underlying communication connection between the client and the server, or it may be caused by other reasons that the underlying communication connection is normal. When the data transmission between the client and the server is abnormal, the underlying communication connection state can be determined to determine whether the underlying communication connection is normal, and the cause of the abnormal data transmission between the client and the server can be further clarified.
[0080] In an embodiment of the present application, determining that data transmission between the client and the server is abnormal according to the confirmation information feedback of the server includes:
[0081] If the confirmation information of the server in response to the keep-alive data feedback is not received within a preset time, it is determined that the data transmission between the client and the server is abnormal; wherein the preset time is greater than the interval between two consecutive sending of keep-alive data.
[0082] Among them, the preset time can be determined according to the actual situation, and can be determined according to the frequency of sending keep-alive data. It can be an integer multiple of the keep-alive data sending period. For example, the frequency of sending keep-alive data is once every 3 seconds. It is predetermined that if the client sends keep-alive data for 3 consecutive times without receiving the confirmation information fed back by the server, it is determined that the data transmission is abnormal. In this case, the preset time can be determined to be 9 seconds. It can also be set to other values. The preset time and the preset frequency of sending keep-alive data can be pre-set and saved in the configuration file, and the client and the server read the configuration file to obtain the preset time and the preset frequency of sending keep-alive data. The beneficial effect of the above scheme is that the preset time is set to verify the receipt of confirmation information, thereby improving the accuracy of transmission abnormality judgment and avoiding the situation where the data transmission is abnormal due to the accidental failure to receive confirmation information.
[0083] S130. Send a communication connection request to the server according to the underlying communication connection status to establish a communication connection with the server.
[0084] Among them, the form of the communication connection request is not limited, and it can be a form determined in advance by the client and the server according to the agreement. In an embodiment of the present application, a communication connection request can be sent to the server according to the state of the underlying communication connection. For example, when sending the communication connection request, it can be determined what information needs to be carried in the request, whether it needs to carry authentication information and tokens, etc., according to the state of the underlying communication connection. The server receives the communication connection request sent by the client, and in response to the communication connection request, establishes a communication connection with the client, thereby realizing the imperceptible re-establishment of the communication connection between the client and the server without interrupting the front-end service, restoring the normal data transmission between the client and the server, ensuring the normal operation of the service, improving the stability of the service, and thus improving the user experience.
[0085] An embodiment of the present invention provides a communication fault handling method applied to a client. The method quickly and directly determines whether data transmission can be carried out normally between the client and the server through keep-alive data. When data transmission cannot be carried out, a connection request is sent to the server to establish a communication connection according to the underlying communication connection status. In this way, the communication connection is automatically and imperceptibly re-established without interrupting the service provided by the client, thereby improving the stability of the service.
[0086] Embodiment 2
[0087] Figure 2 This is a flowchart of another communication failure processing method applied to a client provided in Embodiment 2 of the present application. This embodiment is optimized based on the above embodiment. Figure 2 As shown, the method of this embodiment specifically includes the following steps:
[0088] S210: Send keep-alive data to the server at a preset frequency, and the server feeds back confirmation information to the client in response to the keep-alive data.
[0089] S220. If it is determined that the data transmission between the client and the server is abnormal based on the confirmation information feedback from the server, determine whether the underlying communication connection state is in an interrupted state. If so, execute S230; if not, execute S240.
[0090] In an embodiment of the present application, the process of determining the underlying communication connection state includes:
[0091] If a prompt message indicating that the underlying communication connection is disconnected is detected, the underlying communication connection state is determined to be interrupted; wherein the prompt message is generated when the underlying communication connection is detected to be disconnected;
[0092] If no prompt information indicating that the underlying communication connection is disconnected is detected, it is determined that the underlying communication connection state is connected.
[0093] Exemplarily, the client monitors in real time whether the underlying communication connection with the server is disconnected. If the underlying communication connection is disconnected, the client detects the event of the underlying communication connection being disconnected, and generates a prompt message. The prompt message can be in the form of a pop-up prompt on the front-end service page of the client. If the client detects the prompt message, it determines that the state of the underlying communication connection is interrupted. If no prompt message is detected, it is determined that no event of the underlying communication connection being disconnected is detected, and the state of the underlying communication connection is determined to be connected. The beneficial effect of the above scheme is that by monitoring the prompt message generated when the underlying communication connection is disconnected, the state of the underlying communication connection is accurately judged, and then the connection mode is adaptively determined, thereby improving the efficiency of the connection, and solving the problem of directly creating a new connection when the state of the underlying communication connection is uncertain, and requiring the cumbersome process of re-authentication of information and token verification.
[0094] S230: Send a request to create a new communication connection to the server to re-establish a new communication connection with the server.
[0095] Exemplarily, if the client determines that the underlying communication connection state is in an interrupted state, it determines that the communication link of the protocol layer has been disconnected. At this time, the client needs to re-initiate a request for a new communication connection to the server to re-establish a new communication connection with the server. For example, if the original communication connection is a Socket1 connection, the newly created communication connection is a Socket2 connection. After the server receives the request sent by the client to create a new communication connection, it needs to re-authenticate the information and verify the token Token. The above scheme can detect the disconnection of the underlying communication connection in a timely manner, so as to create a new communication connection in a timely manner in the case of a disconnection, quickly restore the data transmission between the client and the server, and maintain the stability of the service.
[0096] S240: Send a reconnection request for the current communication connection to the server, so as to reconnect with the server based on the current communication connection.
[0097] Among them, the reconnection request may not carry authentication information and token. After receiving the reconnection request based on the current communication connection, the server does not need to perform information authentication and token verification. The session information Session corresponding to the current communication connection has recorded the token information of the first authentication. When the server recognizes that this reconnection request is still a reconnection request for the current communication connection, it directly connects through the reconnection request, thereby shortening the fault recovery time. And the current session information Session can continue to be used, and there is no need to create a new session information Session.
[0098] The embodiment of the present invention provides a communication failure processing method applied to a client. The method determines the underlying communication connection state, and when the underlying communication connection state is interrupted, promptly sends a request to create a new communication connection to achieve reconnection with the server and avoid reconnection failure. When the underlying communication connection state is connected, a reconnection request for the current communication connection is sent, thereby eliminating the process of re-authenticating information and verifying tokens, improving the connection efficiency, and ensuring the stability of the service.
[0099] In the embodiment of the present application, the entire flow chart of establishing a connection between the client and the server and rendering and displaying the screen is as follows: Figure 3 After the client is started, it first loads the resource file rendering page, generates the front-end display page, obtains the configuration file, and establishes a communication connection with the server. If the connection is successful, the server performs information authentication and Token verification. After the verification is successful, the video data sent by the server is received and rendered and displayed on the front-end page. If the communication connection is not interrupted, the video data sent by the server continues to be received for rendering and display. If the communication connection is interrupted, the reconnection process in the above embodiment is executed.
[0100] Embodiment 3
[0101] Figure 4 This is a flowchart of a communication fault handling method applied to a server provided in Example 3 of the present application. This embodiment is applicable to the situation where the server detects and repairs the communication connection between the client and the client. The method can be executed by a communication fault handling device applied to the server. The communication fault handling device can be implemented in the form of hardware and / or software. The communication fault handling device can be configured in an electronic device. For content not described in detail in the embodiments of the present application, such as explanations of terms, etc., please refer to the above embodiments for details. Figure 4 As shown, the method includes:
[0102] S310: Receive keep-alive data sent by a client at a preset frequency, and feed back confirmation information to the client in response to the keep-alive data.
[0103] Exemplarily, when the server and the client are in communication connection, the keep-alive data sent by the client at a preset frequency is received. If the communication connection between the server and the client is abnormal, the server cannot receive the keep-alive data sent by the client. In addition, if the client is abnormal and cannot send the keep-alive data at the preset frequency, the server will also be unable to receive the keep-alive data. After receiving the keep-alive data, the server generates a confirmation message for the keep-alive data, and feeds back the confirmation information to the client, so that the client determines whether there is an abnormality in the data transmission between the client and the server based on the reception of the confirmation information. If the server can receive the keep-alive data sent by the client, and the client can also receive the confirmation information for the keep-alive data fed back by the server, it is determined that the communication connection between the client and the server is normal. If the server cannot normally receive the keep-alive data sent by the client, and / or the client cannot normally receive the confirmation information for the keep-alive data fed back by the server, it is determined that the communication connection between the client and the server is abnormal.
[0104] S320: If abnormal data transmission between the server and the client is determined based on the keep-alive data sending status of the client, the fault is repaired based on the fault detection result.
[0105] The fault detection process can be executed in real time by the server through the established thread. The detection content may include whether the video data is normally acquired, whether the network message can be normally received, whether the session with the client is normal, whether the mouse and keyboard status is normal, etc. In the embodiment of the present application, if it is determined that the data transmission between the server and the client is abnormal based on the sending of the keep-alive data, the corresponding fault is repaired based on the fault detection result.
[0106] An embodiment of the present invention provides a communication fault handling method applied to a server. The method can timely monitor whether data transmission between the client and the server can be carried out normally by receiving keep-alive data from the client, and timely repair the fault when data transmission cannot be carried out to ensure the stability of the service. The method can also respond to feedback confirmation information so that the client can timely determine whether data transmission between the client and the server can be carried out normally.
[0107] Embodiment 4
[0108] Figure 5 This is a flowchart of another communication failure processing method applied to the server provided in the fourth embodiment of the present application. This embodiment is optimized based on the above embodiment. Figure 5 As shown, the method of this embodiment specifically includes the following steps:
[0109] S410: Receive keep-alive data sent by a client at a preset frequency, and feed back confirmation information to the client in response to the keep-alive data.
[0110] S420: Receive a communication connection request sent by the client.
[0111] Exemplarily, when the client determines that data transmission between the client and the server is abnormal based on confirmation information of the keep-alive data, the client sends a communication connection request to the server based on the underlying communication connection state, and the server receives the communication connection request sent by the client.
[0112] S430: Establish a communication connection with the client according to the communication connection request.
[0113] Exemplarily, the server responds to the communication connection request, accepts the content of the client request, or performs information authentication and Token verification on the client, thereby restoring the communication connection with the client.
[0114] In an embodiment of the present application, establishing a communication connection with the client according to the communication connection request includes:
[0115] If a request for creating a new communication connection is received from the client, a communication connection is established with the client, and information authentication and token verification are performed on the client;
[0116] Clear the session information corresponding to the original communication connection, and create the session information corresponding to the new communication connection;
[0117] If a reconnection request for the current communication connection sent by the client is received, a communication connection is established with the client directly through the reconnection request.
[0118] Among them, the session information may include information such as the user name, permissions, login time, client type, IP address, data transmission status, and Socket value of the logged-in client. Exemplarily, if the server receives a request from the client to create a new communication connection, it means that the current underlying communication connection has been interrupted. In this case, a new communication connection needs to be re-established. The server needs to authenticate the client information and verify the token. After the information authentication and token verification are passed, the video data is sent to the client for rendering and display by the client. Since the original communication connection has been disconnected, the session information corresponding to the original communication connection has no effect. It is necessary to clear the session information corresponding to the original communication connection and create the session information corresponding to the new communication connection to record the information generated in the new communication connection. If a reconnection request for the current communication connection sent by the client is received, that is, a reconnection request for the original communication connection, it means that the underlying communication connection is not disconnected, and the protocol layer connection is still normal. The client's reconnection request can be directly accepted, and the client can be reconnected based on the current communication connection to quickly restore the data transmission between the client and the server. The above solution distinguishes the connection requests sent by the client and adaptively determines whether to create a new connection or continue to connect to the original communication link, so as to reconnect based on the current communication connection when the underlying link is not disconnected, eliminating the process of information authentication and token verification, improving connection efficiency, and re-establishing a new connection when the underlying link is disconnected to ensure the successful execution of the reconnection, thereby ensuring the stability of the service.
[0119] S440: Repair the fault according to the fault detection result.
[0120] In the embodiment of the present application, if the client determines that the data transmission between the client and the server is abnormal according to the confirmation information of the keep-alive information, it can be determined that there is a fault, so the cause of the fault can be determined according to the fault detection result of the server, and the fault can be repaired. The execution process of S440 can be after S420, before S430, or after S430, without limitation.
[0121] It should be noted that the above embodiment describes three opportunities for repairing faults based on the fault detection results, namely, after receiving the communication connection request sent by the client, before re-establishing the communication connection with the client, after re-establishing the communication connection with the client, and when the server determines that the data transmission with the client is abnormal based on the keep-alive information. In another implementable scheme, the server can also detect the fault and repair the fault according to the fault detection result when the client service is not running, thereby realizing timely detection and repair of the fault, and repairing the fault even if the service is not running, so as to repair the fault before the service runs again and ensure the normal operation of the service.
[0122] An embodiment of the present invention provides a communication failure handling method applied to a server side, which responds to a communication connection request sent by a client side, thereby promptly restoring data transmission with the client side when data transmission between the client side and the server side cannot be performed, thereby achieving imperceptible reconnection without interrupting the service, thereby ensuring the normal operation of the service.
[0123] In the embodiment of the present application, repairing the fault according to the fault detection result includes:
[0124] Detecting at least one fault respectively through at least one thread, and updating fault status data according to the fault detection result;
[0125] The fault is repaired according to the fault status data.
[0126] Exemplarily, the server can create at least one thread, detect at least one fault through at least one thread, and update the fault status data according to the fault detection result. At least one thread can be executed in parallel to detect at least one fault in parallel, thereby improving the efficiency of fault detection and detecting the fault in a timely manner. Exemplarily, the server can create four threads, creating a first thread Thread1, a second thread Thread2, a third thread Thread3 and a fourth thread Thread4. Thread1 is used to obtain drive video data, and send the drive video data and keyboard and mouse operations to the client. Thread2 is used to send network messages to the client. Thread3 is used to receive keep-alive data sent by the client, and notify Thread2 to feedback confirmation information to the client. Thread4 is used to synchronize the keyboard and mouse operations in the client to the controlled server. In an embodiment of the present application, the timing of thread creation and the operation process of the server are as follows: Figure 6 As shown, the server initializes and obtains the configuration file, creates a thread, and listens to the client's connection request. If it receives a request from the client to create a new communication connection, it establishes a connection with the client and performs information authentication and token verification. If it receives a reconnection request from the client based on the original communication connection, it directly connects through the reconnection request. After the server connects to the client, it sends video data to the client, which is then rendered and displayed.
[0127] The fault detection status data may be a fault detection status represented by a binary number that can be recognized by the electronic device. For example, 0x0008 may be used to indicate that the mouse or keyboard is faulty, and 0x0000 may be used to indicate that the mouse or keyboard is not faulty. The fault detection result can be recorded according to the fault status data, and the server can quickly identify the type of fault according to the fault status data, thereby improving the timeliness of fault repair. The above scheme detects the fault in a timely manner, thereby quickly locking the fault and analyzing the cause of the fault, so as to facilitate timely repair of the fault, solve the problem that the client and the server cannot transmit data normally again due to the fault after reconnecting. In addition, at least one fault is detected in parallel by at least one thread, thereby improving the fault detection efficiency and detecting the fault in a timely and rapid manner.
[0128] It should be noted that the process of repairing the fault according to the fault detection result in the embodiment of the present application can be the process of S320 or the process of S440.
[0129] In an embodiment of the present application, repairing the fault according to the fault status data includes:
[0130] Determine the fault repair method corresponding to the fault state data according to the correspondence between the preset fault state data and the encapsulated preset fault repair method;
[0131] Based on the fault status method, the fault is repaired.
[0132] In an embodiment of the present application, the preset fault repair method can be pre-packaged, and the preset fault repair method can include a method for repairing a video engine fault, a method for repairing a network message fault, a method for repairing a session information fault, a method for repairing a keyboard and mouse fault, etc. The preset fault repair method is stored in correspondence with the preset fault state data. After the server detects a fault through each thread, the fault state data is updated according to the fault detection result, as shown in Table 1, and the fault repair method corresponding to the fault state data is determined according to the correspondence between the pre-stored preset fault state data and the fault repair method, and then the fault is repaired based on the fault state method.
[0133] Table 1
[0134]
[0135]
[0136] The above scheme encapsulates the preset fault repair method in advance and establishes a correspondence between the preset fault status data and the encapsulated preset fault repair method, so as to quickly call the corresponding fault repair method according to the fault status data to repair the fault, thereby improving the efficiency of fault repair.
[0137] Embodiment 5
[0138] Figure 7 A complete flowchart for the specific implementation of a communication fault handling method provided in Example 5 of the present application. Figure 8 A signaling diagram of a communication fault handling method provided in Embodiment 5 of the present application. In the embodiment of the present application, the client is a KVM client, the operating system where the client is located is a BMC, and the communication connection is a Socket connection. Figure 5 As shown, the method of this embodiment specifically includes the following steps:
[0139] S510 , setting a preset time for KVM service fault detection and a preset frequency for sending keep-alive data, saving them to a BMC configuration file, and notifying the server to read them.
[0140] S520, start the KVM client, establish a Socket connection with the server, and perform information authentication and Token verification. After the authentication and verification are successful, start video redirection and send keep-alive data to the server.
[0141] S530: The server receives the keep-alive data and replies to the client, and at the same time performs fault detection and updates fault status data.
[0142] S540: If the client fails to receive the confirmation message of the keep-alive data within the preset time, the reconnection mechanism is triggered. If the server fails to receive the keep-alive data within the preset time, the fault is repaired and the fault status data is updated.
[0143] The reconnection mechanism is as follows: detect the Socket connection status (the underlying communication connection status); if the Socket connection status is interrupted, initiate a request to the server to establish a new communication connection; if the Socket connection status is connected, send a reconnection request based on the current communication connection to the server.
[0144] S550: The server receives the request from the client to reestablish the connection, repairs the connection successfully, and starts video redirection.
[0145] Specifically, Fig. 9As shown in the figure, it is assumed that the first Socket connection created by the client and the server is Socket1, and the corresponding session information is Session1. The new communication connection created again after the underlying communication connection is disconnected is Socket2, and the corresponding session information is Session2. The server detects whether Socket1 is received. If so, it reconnects with the client according to the reconnection request sent by the client. If not, it determines whether Socket2 is received. If so, it determines that the client requests to create a new communication connection. The client's connection request is accepted to establish a new communication connection Socket2 with the client, and information authentication and Token verification are performed. In this case, the session information Session1 corresponding to Socket1 is cleared, and the session information Session2 corresponding to Socket2 is created.
[0146] Embodiment 6
[0147] Fig.10 This is a schematic diagram of the structure of a communication fault processing device provided in Embodiment 6 of the present application. The device can execute the communication fault processing method applied to the client in the present application and has the corresponding functional modules and beneficial effects of the execution method. Fig.10 As shown, the device is configured on an electronic device corresponding to the client, and includes:
[0148] A keep-alive data sending module 610 is used to send keep-alive data to the server at a preset frequency, and the server feeds back confirmation information to the client in response to the keep-alive data;
[0149] A state determination module 620, configured to determine the underlying communication connection state if it is determined that the data transmission between the client and the server is abnormal according to the confirmation information feedback from the server;
[0150] The request sending module 630 is used to send a communication connection request to the server according to the underlying communication connection status, so as to establish a communication connection with the server.
[0151] Further, the request sending module 630 includes:
[0152] A first request sending unit, configured to send a request to create a new communication connection to the server if the underlying communication connection state is interrupted, so as to re-establish a new communication connection with the server;
[0153] The second request sending unit is used to send a reconnection request for the current communication connection to the server if the underlying communication connection state is connected, so as to reconnect with the server based on the current communication connection.
[0154] Furthermore, the state determination module 620 includes:
[0155] A first state determination unit, configured to determine that the state of the underlying communication connection is interrupted if prompt information indicating that the underlying communication connection is disconnected is detected; wherein the prompt information is generated when the underlying communication connection is disconnected;
[0156] The second state determination unit is configured to determine that the state of the underlying communication connection is connected if no prompt information indicating that the underlying communication connection is disconnected is detected.
[0157] Furthermore, the state determination module 620 is specifically configured to:
[0158] If the confirmation information of the server in response to the keep-alive data feedback is not received within a preset time, it is determined that the data transmission between the client and the server is abnormal; wherein the preset time is greater than the interval between two consecutive sending of keep-alive data.
[0159] A communication fault processing device provided in an embodiment of the present application can execute the communication fault processing method applied to the client provided in an embodiment of the present application, and has functional modules and beneficial effects corresponding to the execution method.
[0160] Embodiment 7
[0161] Fig.11 This is a schematic diagram of the structure of a communication fault processing device provided in Embodiment 7 of the present application. The device can execute the communication fault processing method applied to the server in the present application and has the corresponding functional modules and beneficial effects of the execution method. Fig.11 As shown, the device is configured on the server side corresponding to my electronic device, including:
[0162] The keep-alive data receiving module 710 is used to receive the keep-alive data sent by the client at a preset frequency, and to feed back confirmation information to the client in response to the keep-alive data;
[0163] The fault repair module 720 is used to repair the fault according to the fault detection result if abnormal data transmission between the server and the client is determined according to the keep-alive data sending status of the client.
[0164] Furthermore, the device also includes:
[0165] A communication connection request receiving module, used to receive a communication connection request sent by the client;
[0166] A communication connection module is used to establish a communication connection with the client according to the communication connection request.
[0167] Furthermore, the communication connection module includes:
[0168] A new communication connection establishing unit, configured to establish a communication connection with the client upon receiving a request for establishing a new communication connection sent by the client, and to perform information authentication and token verification on the client;
[0169] A clearing unit, used to clear the session information corresponding to the original communication connection and create the session information corresponding to the new communication connection;
[0170] The reconnection unit is configured to establish a communication connection with the client directly through the reconnection request if a reconnection request for the current communication connection sent by the client is received.
[0171] Furthermore, the fault recovery module 720 includes:
[0172] A fault detection unit, configured to detect at least one fault through at least one thread, and update fault status data according to the fault detection result;
[0173] A repair unit is used to repair the fault according to the fault status data.
[0174] Furthermore, the repair unit is specifically used to:
[0175] Determine the fault repair method corresponding to the fault state data according to the correspondence between the preset fault state data and the encapsulated preset fault repair method;
[0176] Based on the fault status method, the fault is repaired.
[0177] A communication fault processing device provided in an embodiment of the present application can execute the communication fault processing method applied to the server provided in an embodiment of the present application, and has functional modules and beneficial effects corresponding to the execution method.
[0178] Embodiment 8
[0179] Fig.12 A schematic diagram of an electronic device 10 that can be used to implement an embodiment of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.
[0180] like Fig.12As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0181] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0182] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (target device PU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a communication fault processing method.
[0183] In some embodiments, the communication failure handling method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the communication failure handling method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the communication failure handling method in any other appropriate manner (e.g., by means of firmware).
[0184] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0185] Computer programs for implementing the methods of the present application may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable target determination device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0186] In the context of the present application, a computer readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device or equipment. A computer readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer readable storage medium may be a machine readable signal medium. A more specific example of a machine readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0187] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0188] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0189] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0190] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the information expected by the technical solution of this application can be achieved, and this document is not limited here.
[0191] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.
Claims
1. A communication fault processing method, characterized in that: Applied to a client, the method comprises: Sending keep-alive data to the server at a preset frequency, and the server feeding back confirmation information to the client in response to the keep-alive data; If it is determined that the data transmission between the client and the server is abnormal according to the confirmation information feedback of the server, then determining the underlying communication connection state; According to the underlying communication connection status, a communication connection request is sent to the server to establish a communication connection with the server.
2. The method according to claim 1, characterized in that: According to the underlying communication connection state, sending a communication connection request to the server includes: If the underlying communication connection state is interrupted, sending a request to the server to create a new communication connection, so as to re-establish a new communication connection with the server; If the underlying communication connection state is connected, a reconnection request for the current communication connection is sent to the server, so as to reconnect with the server based on the current communication connection.
3. The method according to claim 2, characterized in that Determine the underlying communication connection status, including: If a prompt message indicating that the underlying communication connection is disconnected is detected, the underlying communication connection state is determined to be interrupted; wherein the prompt message is generated when the underlying communication connection is detected to be disconnected; If no prompt information indicating that the underlying communication connection is disconnected is detected, it is determined that the underlying communication connection state is connected.
4. The method according to claim 1, characterized in that: Determining data transmission abnormality between the client and the server according to the confirmation information feedback of the server includes: If the confirmation information of the server in response to the keep-alive data feedback is not received within a preset time, it is determined that the data transmission between the client and the server is abnormal; wherein the preset time is greater than the interval between two consecutive sending of keep-alive data.
5. A communication failure processing method, characterized in that: Applied to the server, the method includes: receiving keep-alive data sent by a client at a preset frequency, and feeding back confirmation information to the client in response to the keep-alive data; If abnormal data transmission between the server and the client is determined according to the keep-alive data sending status of the client, the fault is repaired according to the fault detection result.
6. The method according to claim 5, characterized in that The method further comprises: Receiving a communication connection request sent by the client; Establishing a communication connection with the client according to the communication connection request.
7. The method according to claim 6, characterized in that Establishing a communication connection with the client according to the communication connection request includes: If a request for creating a new communication connection is received from the client, a communication connection is established with the client, and information authentication and token verification are performed on the client; Clear the session information corresponding to the original communication connection, and create the session information corresponding to the new communication connection; If a reconnection request for the current communication connection sent by the client is received, a communication connection is established with the client directly through the reconnection request.
8. The method according to claim 5, characterized in that Repair the fault according to the fault detection result, including: Detecting at least one fault respectively through at least one thread, and updating fault status data according to the fault detection result; The fault is repaired according to the fault status data.
9. The method according to claim 8, characterized in that Repairing the fault according to the fault status data includes: Determine the fault repair method corresponding to the fault state data according to the correspondence between the preset fault state data and the encapsulated preset fault repair method; Based on the fault status method, the fault is repaired.
10. A communication fault processing device, characterized in that: The electronic device configured on the client side includes: A keep-alive data sending module, used for sending keep-alive data to the server at a preset frequency, and the server feeds back confirmation information to the client in response to the keep-alive data; A status determination module, configured to determine the underlying communication connection status if it is determined that data transmission between the client and the server is abnormal according to the confirmation information feedback of the server; The request sending module is used to send a communication connection request to the server according to the underlying communication connection status, so as to establish a communication connection with the server.
11. A communication fault processing device, characterized in that: The electronic device configured at the server side includes: A keep-alive data receiving module, configured to receive keep-alive data sent by a client at a preset frequency, and feed back confirmation information to the client in response to the keep-alive data; The fault repair module is used to repair the fault according to the fault detection result if abnormal data transmission between the server and the client is determined according to the keep-alive data sending status of the client.
12. An electronic device, characterized in that: The device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the communication fault handling method applied to the client as described in any one of claims 1-4, or execute the communication fault handling method applied to the server as described in any one of claims 5-9.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by the processing device, it implements the communication fault processing method applied to the client as described in any one of claims 1-4, or executes the communication fault processing method applied to the server as described in any one of claims 5-9.
