Communication method and device, electronic equipment and storage medium

By using the heartbeat mechanism and timer to detect the connection status between the intelligent cockpit domain and other control domains, and re-establishing the connection in a timely manner, the problem of communication interruption caused by network problems is solved and the continuity and reliability of information transmission are ensured.

CN118631884APending Publication Date: 2024-09-10BEIJING CHEHEJIA AUTOMOBILE TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202310218640.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-08
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

The communication connection between the smart cockpit domain and other control domains was disconnected due to network problems, resulting in the client being unable to detect and re-establish the connection in time, affecting information transmission.

Method used

Send heartbeat data through the heartbeat mechanism and start the timer. If no response information is received within the set time, it is determined that the connection is disconnected and a connection request is sent to re-establish the connection.

Benefits of technology

The heartbeat mechanism detects connection abnormalities in a timely manner to ensure communication continuity, avoid service interruption, and improve communication reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118631884A
    Figure CN118631884A
Patent Text Reader

Abstract

The invention provides a communication method and device, electronic equipment and a storage medium, and the method comprises the steps: sending heartbeat data to a target server, and starting a timer; wherein the timing duration of the timer is set duration, under the condition that response information of heartbeat data sent by the target server side is not received within the set duration, it is determined that the connection state of the client side and the target server side is abnormal, and a connection request is sent to the target server side, the method and the device are used for re-establishing the connection between the client and the target server by the target server, and the abnormal state of the connection between the client and the target server is found in time through a heartbeat mechanism, so that the connection request is sent in time to re-establish the connection, the communication is ensured, and the service interruption is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a communication method, device, electronic device and storage medium. Background Art

[0002] In the current design architecture of electronic devices, such as automobiles, the entire vehicle system is divided into multiple domains according to the functions of automotive electronic components, including several control domains such as the smart cockpit domain and the autonomous driving domain. Among them, the central control screen in the smart cockpit domain is responsible for displaying the interface data to be displayed in other control domains on the vehicle side for users to view.

[0003] In actual scenarios, there is a communication connection between the client in the smart cockpit domain and other control domains. The communication connection may be disconnected due to network problems. The client and other control domains cannot perceive the disconnection of the communication connection in time, resulting in communication interruption and affecting the transmission of information. Summary of the invention

[0004] The present application proposes a communication method, device, electronic device and storage medium, which can promptly detect abnormal connection status through a heartbeat mechanism, thereby promptly re-establishing the connection and ensuring the communication.

[0005] In one aspect, an embodiment of the present application provides a communication method, including:

[0006] Send heartbeat data to the target server and start a timer; wherein the timing duration of the timer is the set duration;

[0007] If no response information of the heartbeat data sent by the target server is received within the set time period, determining that the connection between the client and the target server is disconnected;

[0008] Sending a connection request to the target server; wherein the connection request is used by the target server to re-establish a connection between the client and the target server.

[0009] Another aspect of the present application provides a communication method, including:

[0010] Start a timer and monitor the heartbeat data sent by the client; wherein the timing duration of the timer is a set duration;

[0011] If the heartbeat data sent by the client is not received within a set time period, disconnecting the connection with the client;

[0012] Monitoring the connection request sent by the client;

[0013] When the connection request is detected, the connection between the client and the target server is reestablished.

[0014] Another aspect of the present application provides a communication device, including:

[0015] A startup module is used to send heartbeat data to a target server and start a timer; wherein the timing duration of the timer is a set duration;

[0016] A determination module, configured to determine that the connection between the client and the target server is disconnected if no response information of the heartbeat data sent by the target server is received within the set time period;

[0017] The sending module is used to send a connection request to the target server; wherein the connection request is used by the target server to re-establish the connection between the client and the target server.

[0018] Another aspect of the present application provides a communication device, including:

[0019] A startup module is used to start a timer and monitor the heartbeat data sent by the client; wherein the timing duration of the timer is a set duration;

[0020] A disconnection module, used to disconnect the connection with the client if the heartbeat data sent by the client is not received within a set time period;

[0021] A monitoring module, used for monitoring the connection request sent by the client;

[0022] The reconnection module is used to reestablish the connection between the client and the target server when the connection request is detected.

[0023] Another aspect of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method described in the first aspect or the second aspect is implemented.

[0024] Another aspect of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method described in the first aspect or the method described in the second aspect is implemented.

[0025] Another aspect of the present application provides a computer program product on which a computer program is stored. When the program is executed by a processor, the method described in the first aspect or the second aspect is implemented.

[0026] The communication method, device, electronic device and storage medium proposed in the present application send heartbeat data to the target server and start a timer; wherein the timing duration of the timer is a set duration, and when no response information of the heartbeat data sent by the target server is received within the set duration, it is determined that the connection between the client and the target server is disconnected, and a connection request is sent to the target server, wherein the connection request is used by the target server to re-establish the connection between the client and the target server, and the abnormal connection status between the client and the target server is discovered in time through the heartbeat mechanism, so that a connection request is sent in time to re-establish the connection, thereby ensuring the communication and avoiding service interruption. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0028] Figure 1 A flow chart of a communication method provided in an embodiment of the present application;

[0029] Figure 2 A flowchart of another communication method provided in an embodiment of the present application;

[0030] Figure 3 A flowchart of another communication method provided in an embodiment of the present application;

[0031] Figure 4 A flowchart of another communication method provided in an embodiment of the present application;

[0032] Figure 5 A schematic diagram of a structure for communication between a client and a target server provided in an embodiment of the present application;

[0033] Figure 6 A schematic diagram of the structure of a communication device provided in an embodiment of the present application;

[0034] Figure 7 A schematic diagram of the structure of a communication device provided in an embodiment of the present application;

[0035] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0036] Embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.

[0037] The communication method, device, electronic device and storage medium of the embodiments of the present application are described below with reference to the accompanying drawings.

[0038] Figure 1 A flow chart of a communication method provided in an embodiment of the present application.

[0039] The execution subject of the communication method in the embodiment of the present application is the client.

[0040] like Figure 1 As shown, the method may include the following steps:

[0041] Step 101, send heartbeat data to the target server and start the timer.

[0042] The timing duration of the timer is the set duration, and the set duration of the timer is the maximum duration for determining whether the connection between the client and the target server is disconnected. That is to say, if the timer reaches the set duration and still does not receive the response information of the heartbeat data, it is considered that the connection is disconnected. The set duration can be set according to demand, for example, 3 seconds, 5 seconds, etc., which is not limited in this embodiment.

[0043] In the embodiment of the present application, there are multiple domains in the vehicle computer. In the cross-domain display scenario, the client is an application related to display in the smart cockpit domain of the vehicle computer. Data is obtained from other control domains through the application, and displayed on the central control screen in the smart cockpit domain. The application includes a browser function, which can be an application of a web browser, or an application including a web browser function. The vehicle computer can display data in any control domain. Each control domain can be divided into a service end and a service in the service end. Different control domains implement different functions. For each control domain, after the client and the service end establish a connection, the client sends a message to the server end, requesting to obtain and display the data in the corresponding service, or when the service has data to be displayed on the front-end client, the service end sends the data to be displayed to the front-end client through the server end to display on the central control screen. Among them, the service can be a service that provides multimedia data, a service that provides vehicle driving status, a service that provides vehicle surrounding environment data, a service that provides data required for vehicle automatic driving, or a service that provides vehicle temperature control, etc., which is not limited in this embodiment. Among them, the target service end is also called the target service docking management, which is used to manage and schedule the connection between the application and the service in the domain, and can belong to any control domain.

[0044] The heartbeat data may be a heartbeat packet, which is sent by the client to the target server to detect whether the communication link is unobstructed. As an implementation method, the heartbeat packet may be sent periodically by the client. Specifically, a sending period is obtained, wherein the sending period may be set by the system, and at least one heartbeat data is sent according to the sending period. By periodically sending the heartbeat data, the failure of the heartbeat data to be sent due to delay or instability of the network link is avoided, thereby improving the reliability of the heartbeat data sending.

[0045] Step 102: If no response information of receiving the heartbeat data sent by the target server is received within a set time period, it is determined that the connection between the client and the target server is disconnected.

[0046] In the embodiment of the present application, after sending the heartbeat data, the client will continuously monitor the response information fed back by the target server after receiving the heartbeat data, and the response information is used to indicate that the server has received the heartbeat data sent by the client. If the response information sent by the target server is not received within the set time, it means that there is an abnormality in the connection state of the communication connection between the target server and the client, for example, the connection is disconnected, or the connection is unstable.

[0047] Step 103: Send a connection request to the target server.

[0048] The connection request is used by the target server to re-establish the connection between the client and the target server.

[0049] In an embodiment of the present application, when it is determined that there is an abnormality in the connection between the client and the target server, the client sends a connection request to the target server so that the target server re-establishes the connection according to the connection request, so that the interrupted communication link is restored as soon as possible, thereby ensuring the communication and avoiding business interruption.

[0050] In the communication method of the embodiment of the present application, heartbeat data is sent to the target server and a timer is started; wherein the timing duration of the timer is a set duration, and when no response information of the heartbeat data sent by the target server is received within the set duration, it is determined that the connection status between the client and the target server is abnormal, and a connection request is sent to the target server, wherein the connection request is used by the target server to re-establish the connection between the client and the target server, and the abnormal connection status between the client and the target server is discovered in time through the heartbeat mechanism, so that a connection request is sent in time to re-establish the connection, thereby ensuring the communication and avoiding service interruption.

[0051] Based on the above embodiments, Figure 2 A flow chart of another communication method provided in an embodiment of the present application is shown as follows: Figure 2 As shown, the method comprises the following steps:

[0052] Step 201, obtaining the sending period of heartbeat data and network status information.

[0053] Step 202: Adjust the sending period according to the network status information.

[0054] Step 203: Send heartbeat data according to the adjusted sending cycle and start the timer.

[0055] The timing duration of the timer is the set duration.

[0056] In the embodiment of the present application, by periodically sending heartbeat data, the connection status between the client and the target server can be determined, and whether the connection is interrupted can be found in time to reconnect as soon as possible. In order to reduce the load of the client or the server, the sending period of the heartbeat data can be flexibly configured.

[0057] As an implementation method, network status information can be obtained, and the network status information indicates the network quality of the client and server connection. The network quality can be divided into multiple levels, for example 0-4, 4 levels, the higher the level, the better the quality, and the lower the level, the worse the quality. In one scenario, when the network quality is determined to be a set higher level, for example, the network quality level is considered to be 2, 3 and 4, then the network quality is considered to be good, and the sending interval of the heartbeat data can be increased, that is, the sending period can be increased, for example, the sending period can be increased from 1 second to 2 seconds, that is, from sending a heartbeat data every 1 second to sending a heartbeat data every 2 seconds. In another scenario, when the network quality is determined to be at a set lower level, for example, the network quality level is considered to be level 1, which means the network quality is poor. In this case, the sending interval of the heartbeat data can be reduced, that is, the sending period can be reduced. For example, the sending period can be reduced from 2 seconds to 1 second, that is, from sending a heartbeat data every 2 seconds to sending a heartbeat data every 1 second. By adjusting the sending period of the heartbeat packet through the network status, the load on the client and the server can be reduced, while ensuring the recognition of the communication connection status, and at the same time reducing the power consumption of the interaction and saving energy.

[0058] Step 204: If no response information of the heartbeat data sent by the target server is received within the set time period, it is determined that the connection between the client and the target server is disconnected.

[0059] Step 205: Send a connection request to the target server.

[0060] The connection request is used by the target server to re-establish the connection between the client and the target server.

[0061] Step 206: Issue an abnormal warning.

[0062] In an embodiment of the present application, if the response information of the heartbeat data sent by the target server is not received within the set time, an abnormal warning can also be issued. As an implementation method, a pop-up window can be displayed in the interactive interface of the client to display the abnormal situation of the connection status through the pop-up window, for example, to show that the connection has been disconnected. As a second implementation method, a sound warning can be issued by the client to prompt that the connection is abnormal and needs to be reconnected, so as to quickly discover the abnormality of the connection status and achieve reconnection as soon as possible.

[0063] It should be noted that the abnormal warning may be performed before step 204 and step 205, or after step 204 and step 205, or may be performed simultaneously, which is not limited in this embodiment.

[0064] Step 207: When a response message of the heartbeat data sent by the target server is received within the set time period, the timer is reset.

[0065] In an embodiment of the present application, when a response message of the heartbeat data sent by the target server is received within a set time period, the client believes that the connection status is normal and the connection is not disconnected, so the timer is reset, that is, the timer is cleared to zero and the timing is restarted to continue to detect the connection status between the client and the server, thereby realizing the detection of continuous communication connection.

[0066] In the communication method of the embodiment of the present application, there are multiple domains in the vehicle computer. In the cross-domain display scenario, in order to achieve uninterrupted business related to the displayed information, the heartbeat data can be sent periodically to achieve interaction between the client and the target server, so that the client can perceive the abnormal state of the link in time, trigger the exception handling logic, that is, re-establish the connection and issue an abnormal information warning, so that the user can perceive the abnormal state of the connection in time, and then the application program keeps trying to restore the link as soon as possible to ensure timely recovery of the business, improve the reliability of communication, and achieve the reliability of communication in the cross-domain display scenario.

[0067] Figure 3 This is a flow chart of another communication method provided in an embodiment of the present application. The execution subject is the target server. Please refer to the explanation of the target server in the above embodiment, which will not be repeated here. Figure 3 As shown, the method comprises the following steps:

[0068] Step 301, start the timer and monitor the heartbeat data sent by the client.

[0069] The timer duration is a set duration. The target server monitors the heartbeat data sent by the client within the set duration of the timer to identify the state of the communication connection between the client and the target server. The state of the communication connection is a disconnected state and a connected state. For example, the set duration is 3 seconds.

[0070] Step 302: If the heartbeat data sent by the client is not received within a set time period, the connection with the client is disconnected.

[0071] In an embodiment of the present application, when the heartbeat data sent by the client is not received within the set time period, it is considered that the client does not need to communicate with the target server, and the disconnection logic is executed, that is, the connection between the client and the target server is disconnected to release the connection between the target server and the client, thereby reducing the consumption of system resources.

[0072] Step 303: monitor the connection request sent by the client.

[0073] Step 304: When a connection request is detected, reestablish the connection between the client and the target server.

[0074] In the embodiment of the present application, when the connection with the client is disconnected, the connection request sent by the client is monitored, and the connection request is used to request the target client to establish a connection. When the connection request is monitored, the connection between the client and the target server is reestablished to achieve the reconnection of the communication link, ensure that the business between the client and the target server is restored as soon as possible, and ensure the communication.

[0075] In one implementation of an embodiment of the present application, a link handle for connecting with the client is determined based on a connection request, and the link handle is used to establish a connection between the client and the target server. Specifically, the link handle for connecting the target server and the client can be determined based on information carried in the connection request, and the link handle can realize the connection between the target server and the client to achieve communication.

[0076] In the communication method of the embodiment of the present application, a timer is started and the heartbeat data sent by the client is monitored; wherein, the timing duration of the timer is a set duration, and when the heartbeat data sent by the client is not received within the set duration, the connection with the client is disconnected, and the connection request sent by the client is monitored, and when the connection request is monitored, the connection between the client and the target server is re-established, and the abnormal connection status between the client and the target server is discovered in time through the heartbeat mechanism, so that the connection is re-established in time to ensure the communication and avoid service interruption.

[0077] Based on the above embodiments, Figure 4 A flow chart of another communication method provided in an embodiment of the present application, wherein the execution subject is the target server, such as Figure 4 As shown, the method comprises the following steps:

[0078] Step 401, start the timer and monitor the heartbeat data sent by the client.

[0079] The timing duration of the timer is the set duration.

[0080] Step 402: If the heartbeat data sent by the client is not received within a set time period, the connection with the client is disconnected.

[0081] Among them, step 401 and step 402 can refer to the explanation in the above-mentioned embodiment, and the principles are the same, so they will not be repeated here.

[0082] Step 403, sending disconnection information to the service connected to the target server.

[0083] The disconnection information is used to trigger the service to record exception logs.

[0084] In an embodiment of the present application, when the target server disconnects from the client, it sends disconnection information to the service connected to the target server, thereby triggering the service to perform logging to record the abnormal connection situation and prevent the service from continuing to send data to the client, causing functional disorder.

[0085] Step 404: monitor the connection request sent by the client.

[0086] Step 405: When a connection request is detected, re-establish the connection between the client and the target server.

[0087] Among them, step 404 and step 405 can refer to the explanation in the above-mentioned embodiment, and the principles are the same, so they will not be repeated here.

[0088] Step 406: When the heartbeat data sent by the client is received within the set time period, a response message of the heartbeat data is sent to the client, and the timer is reset.

[0089] In an embodiment of the present application, when the heartbeat data sent by the client is received within the set time period and it is determined that the connection is normal, a response message of the heartbeat data is sent to the client to notify the client that the connection is normal, and the timer is reset to re-monitor the heartbeat data sent by the client to achieve continuous monitoring of the connection, ensure smooth communication, and improve the reliability of communication.

[0090] In the communication method of the embodiment of the present application, when the connection with the client is disconnected, the connection request sent by the client is monitored, and the connection request is used to request the target client to establish a connection. When the connection request is detected, the connection between the client and the target server is re-established to achieve the reconnection of the communication link, ensure that the business between the client and the target server is restored as soon as possible, and ensure the communication. At the same time, the abnormal situation of the connection is synchronized to the service connected to the target server in a timely manner, triggering the service to record the abnormal log, which is convenient for subsequent data analysis and problem troubleshooting.

[0091] As an example, Figure 5 A schematic diagram of a structure for communication between a client and a target server provided in an embodiment of the present application, wherein the client is an application app in the smart cockpit domain, and the target server is a websocket_server in the autonomous driving domain, i.e., service docking management, and cross-domain display is achieved through interaction between the two domains. The communication method between the application and the target server can refer to the explanation in the aforementioned embodiment, and will not be repeated here.

[0092] In order to implement the above embodiment, the embodiment of the present application also proposes a communication device.

[0093] Figure 6 A schematic diagram of the structure of a communication device provided in an embodiment of the present application.

[0094] like Figure 6 As shown, the device may include:

[0095] The starting module 61 is used to send heartbeat data to the target server and start a timer; wherein the timing duration of the timer is a set duration.

[0096] The determination module 62 is used to determine that the connection between the client and the target server is disconnected when no response information of the heartbeat data sent by the target server is received within the set time period.

[0097] The sending module 63 is used to send a connection request to the target server; wherein the connection request is used by the target server to re-establish the connection between the client and the target server.

[0098] Furthermore, in an implementation of the embodiment of the present application, the device further includes:

[0099] The warning module is used to issue an abnormal warning when the response information of the heartbeat data sent by the target server is not received within the set time period.

[0100] Furthermore, in an implementation of the embodiment of the present application, the device further includes:

[0101] A reset module is used to reset the timer when a response message of the heartbeat data sent by the target server is received within the set time period.

[0102] Further, in an implementation of the embodiment of the present application, the startup module 61 is specifically used to:

[0103] Get the sending cycle and network status information of heartbeat data;

[0104] Adjusting the sending cycle according to the network status information;

[0105] At least one heartbeat data is sent according to the adjusted sending cycle.

[0106] It should be noted that the above explanation of the method embodiment is also applicable to the device of this embodiment, and will not be repeated here.

[0107] In the communication device of the embodiment of the present application, heartbeat data is sent to the target server and a timer is started; wherein the timing duration of the timer is a set duration, and when no response information of the heartbeat data sent by the target server is received within the set duration, it is determined that the connection between the client and the target server is disconnected, and a connection request is sent to the target server, wherein the connection request is used by the target server to re-establish the connection between the client and the target server, and the abnormal connection status between the client and the target server is discovered in time through the heartbeat mechanism, so that a connection request is sent in time to re-establish the connection, thereby ensuring the communication and avoiding service interruption.

[0108] In order to implement the above embodiment, the embodiment of the present application also proposes a communication device.

[0109] Figure 7 A schematic diagram of the structure of a communication device provided in an embodiment of the present application.

[0110] like Figure 7 As shown, the device may include:

[0111] The start module 71 is used to start the timer and monitor the heartbeat data sent by the client; wherein the timing duration of the timer is the set duration.

[0112] The disconnection module 72 is used to disconnect the connection with the client when the heartbeat data sent by the client is not received within a set time period.

[0113] The monitoring module 73 is used to monitor the connection request sent by the client.

[0114] The reconnection module 74 is used to reestablish the connection between the client and the target server when the connection request is detected.

[0115] Furthermore, in one implementation of the embodiment of the present application, the device further includes:

[0116] The synchronization module is used to send the disconnection information to the service connected to the target server when the heartbeat data sent by the client is not received within a set time period; the disconnection information is used to trigger the service to perform abnormal log recording.

[0117] In one implementation of the embodiment of the present application, the device further includes:

[0118] The reset module is used to send response information of the heartbeat data to the client and reset the timer when the heartbeat data sent by the client is received within a set time period.

[0119] In one implementation of the embodiment of the present application, the reconnection module 74 is specifically configured to:

[0120] Determining a link handle for connecting to the client according to the connection request;

[0121] The link handle is used to establish a connection between the client and the target server.

[0122] It should be noted that the above explanation of the method embodiment is also applicable to the device of this embodiment, and will not be repeated here.

[0123] In the communication device of the embodiment of the present application, when the connection with the client is disconnected, the connection request sent by the client is monitored, and the connection request is used to request the target client to establish a connection. When the connection request is monitored, the connection between the client and the target server is re-established to achieve the reconnection of the communication link, ensure that the business between the client and the target server is restored as soon as possible, and ensure the communication. At the same time, the abnormal situation of the connection is synchronized to the service connected to the target server in a timely manner, triggering the service to record the abnormal log, which is convenient for subsequent data analysis and problem troubleshooting.

[0124] In order to implement the above embodiments, the present application also proposes an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method described in the above method embodiments is implemented.

[0125] In order to implement the above embodiments, the present application also proposes a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method described in the above method embodiments is implemented.

[0126] In order to implement the above embodiments, the present application also proposes a computer program product on which a computer program is stored. When the computer program is executed by a processor, the method described in the above method embodiments is implemented.

[0127] Figure 8 A structural block diagram of an electronic device provided in an embodiment of the present application. Figure 8 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application. The electronic device can be a terminal device or a server.

[0128] like Figure 8 As shown, the electronic device 10 includes a processor 11, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 12 or a program loaded from a memory 16 to a random access memory (RAM) 13. Various programs and data required for the operation of the electronic device 10 are also stored in the RAM 13. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0129] The following components are connected to the I / O interface 15: a memory 16 including a hard disk, etc.; and a communication part 17 including a network interface card such as a LAN (Local Area Network) card, a modem, etc., and the communication part 17 performs communication processing via a network such as the Internet; a drive 18 is also connected to the I / O interface 15 as needed.

[0130] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 17. When the computer program is executed by the processor 11, the above-mentioned functions defined in the method of the present application are executed.

[0131] In an exemplary embodiment, a storage medium including instructions is also provided, such as a memory 16 including instructions, and the instructions can be executed by the processor 11 of the electronic device 10 to complete the above method. Optionally, the storage medium can be a non-transitory computer-readable storage medium, for example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0132] It should be noted that, in this article, relational terms such as "first" and "second" 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 term "comprises" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or 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 device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

Claims

1. A communication method, characterized in that: include: Send heartbeat data to the target server and start a timer; wherein the timing duration of the timer is the set duration; If no response information of the heartbeat data sent by the target server is received within the set time period, determining that the connection between the client and the target server is disconnected; Sending a connection request to the target server; wherein the connection request is used by the target server to re-establish a connection between the client and the target server.

2. The method according to claim 1, characterized in that After sending the heartbeat data to the target server and starting the timer, the method further includes: If no response information of the heartbeat data sent by the target server is received within the set time period, an abnormal warning is issued.

3. The method according to claim 1, characterized in that After sending the heartbeat data to the target server and starting the timer, the method further includes: When a response message of the heartbeat data sent by the target server is received within the set time period, the timer is reset.

4. The method according to any one of claims 1 to 3, characterized in that: The sending of heartbeat data to the target server includes: Get the sending cycle and network status information of heartbeat data; Adjusting the sending cycle according to the network status information; At least one heartbeat data is sent according to the adjusted sending cycle.

5. A communication method, characterized in that: include: Start a timer and monitor the heartbeat data sent by the client; wherein the timing duration of the timer is a set duration; If the heartbeat data sent by the client is not received within a set time period, disconnecting the connection with the client; Monitoring the connection request sent by the client; When the connection request is detected, the connection between the client and the target server is reestablished.

6. The method according to claim 5, characterized in that After starting the timer and monitoring the heartbeat data sent by the client, the method further includes: When the heartbeat data sent by the client is not received within a set time period, the disconnection information is sent to the service connected to the target server; the disconnection information is used to trigger the service to perform abnormal log recording.

7. The method according to claim 5 or 6, characterized in that After starting the timer and monitoring the heartbeat data sent by the client, the method further includes: When the heartbeat data sent by the client is received within a set time period, response information of the heartbeat data is sent to the client, and the timer is reset.

8. The method according to claim 5 or 6, characterized in that The re-establishing the connection between the client and the target server includes: Determining a link handle for connecting to the client according to the connection request; The link handle is used to establish a connection between the client and the target server.

9. A communication device, characterized in that: include: A startup module is used to send heartbeat data to a target server and start a timer; wherein the timing duration of the timer is a set duration; A determination module, configured to determine that the connection between the client and the target server is disconnected if no response information of the heartbeat data sent by the target server is received within the set time period; The sending module is used to send a connection request to the target server; wherein the connection request is used by the target server to re-establish the connection between the client and the target server.

10. A communication device, characterized in that: include: A startup module is used to start a timer and monitor the heartbeat data sent by the client; wherein the timing duration of the timer is a set duration; A disconnection module, used to disconnect the connection with the client if the heartbeat data sent by the client is not received within a set time period; A monitoring module, used for monitoring the connection request sent by the client; The reconnection module is used to reestablish the connection between the client and the target server when the connection request is detected.

11. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the program, the method according to any one of claims 1 to 4 is implemented, or the method according to any one of claims 5 to 8 is implemented.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method described in any one of claims 1 to 4 is implemented, or the method described in any one of claims 5 to 8 is implemented.

Citation Information

Cited By

  • Session connection monitoring method and device, equipment and storage medium

    CN119728483A