Heartbeat protocol control method and system and related products
By sending heartbeat packets at irregular intervals and combining them with random data encryption, the resource consumption problem caused by the interleaved sending and receiving of heartbeat and interaction protocols is solved, thereby improving communication efficiency and security.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2026-03-10
AI Technical Summary
In existing technologies, the interleaved transmission and reception of heartbeat and interaction protocols leads to excessive resource consumption and affects parsing efficiency.
By sending heartbeat packets at irregular intervals, the timing of the next heartbeat packet is determined by detecting non-heartbeat protocol communication. Random data is mixed into the heartbeat packet for encryption to improve communication security.
This reduces the number of heartbeats sent and received, lowers resource consumption, and improves communication efficiency and security.
Smart Images

Figure CN121644429A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of communication, and in particular to a heartbeat protocol control method and system, and related products. BACKGROUND
[0002] In existing instruments and equipment, hardware is generally divided into multiple functional modules, such as display interaction modules, main control modules, and power supply modules, and the like. These functional modules are combined together to form a complete instrument. Fixed heartbeat logic is usually used between different modules to ensure that the communication state between the modules is normal. For example, module 1 sends a heartbeat packet to module 2 once every fixed time interval, so as to determine whether the connection between module 1 and module 2 is normal.
[0003] However, as shown in FIG. 1, the existing interaction protocol (such as a touch screen click instruction) and other protocols are staggered with the heartbeat protocol, which causes a large amount of resources to be additionally allocated to processing the heartbeat protocol while the interaction protocol is being parsed, thereby occupying too many resources and affecting the parsing efficiency of the interaction protocol. Figure 1 SUMMARY
[0004] Embodiments of the present application provide a heartbeat protocol control method and system, and related products, for reducing the resource occupation of the heartbeat protocol.
[0005] A first aspect of embodiments of the present application provides a heartbeat protocol control method applied to a first module and a second module of an instrument device, including:
[0006] After the first module sends a heartbeat packet to the second module once, the first module is controlled to send a heartbeat packet to the second module again at an indefinite time, so as to determine whether the communication state between the first module and the second module is normal.
[0007] Optionally, after the first module sends a heartbeat packet to the second module once, the first module is controlled to send a heartbeat packet to the second module again at an indefinite time, including:
[0008] Within a preset time interval after the first module sends a heartbeat packet to the second module, it is detected whether there is communication based on a non-heartbeat protocol between the first module and the second module;
[0009] If there is, the first module is controlled to send a heartbeat packet to the second module again after the communication time is extended by the preset time interval;
[0010] If there is not, the first module is controlled to send a heartbeat packet to the second module again immediately.
[0011] Optionally, the preset time interval is any length within 100 ms to 1200 ms.
[0012] Optionally, after the preset time interval is extended from the communication time, the first module is controlled to send a heartbeat packet to the second module again, including:
[0013] After the preset time interval is extended once, if the communication between the first module and the second module is still detected, the sending time of the heartbeat packet is extended again until the sending time is extended for a preset number of times, and the first module is controlled to send a heartbeat packet to the second module again.
[0014] Optionally, the preset number of times is any number of times within 2 to 5 times.
[0015] Optionally, after the first module sends a heartbeat packet to the second module each time, the first module is controlled to send a heartbeat packet to the second module again at an indefinite time, including:
[0016] The time of the last heartbeat packet is taken as a starting point, and after a random interval each time, the first module is controlled to send a heartbeat packet to the second module again.
[0017] Optionally, the method further includes:
[0018] Random data is mixed into the heartbeat packet, so that the second module verifies the identity of the first module by encrypting or decrypting the random data.
[0019] Optionally, the method further includes:
[0020] If the communication state is correctly determined by a preset number of times of sending heartbeat packets, new version random data is mixed into the next heartbeat packet of the preset number of times; the new version random data is different from the random data in the preset number of times of heartbeat packets.
[0021] Optionally, the method further includes:
[0022] The random data is used as a security element of a non-heartbeat protocol to enhance the difficulty of cracking the content of the non-heartbeat protocol when the content is communicated between the first module and the second module.
[0023] The method of the first aspect of the application can be implemented by the content of the second aspect of the application.
[0024] The second aspect of the embodiment of the application provides a heartbeat protocol control system, including: a processing unit;
[0025] The processing unit is configured to control the first module to send a heartbeat packet to the second module again at a non-fixed interval after each time the first module sends a heartbeat packet to the second module, so as to determine whether the communication state between the first module and the second module is normal.
[0026] The third aspect of the embodiments of the present application provides an electronic device, comprising: a processor and a memory.
[0027] The processor is configured to communicate with the memory and execute instructions in the memory to implement the method described in the first aspect of the embodiments of the present application or any specific implementation manner of the first aspect.
[0028] The fourth aspect of the embodiments of the present application provides a computer readable storage medium, the readable storage medium stores computer instructions, and the computer instructions are executed by a processor to implement the method described in the first aspect of the embodiments of the present application or any specific implementation manner of the first aspect.
[0029] The fifth aspect of the embodiments of the present application provides a computer program product, the computer program product comprises computer instructions, and the computer instructions are executed by a processor to implement the method described in the first aspect of the embodiments of the present application or any specific implementation manner of the first aspect.
[0030] From the above technical solutions, the embodiments of the present application have at least the following advantages:
[0031] Compared with the form of sending heartbeat packets at a fixed interval in the prior art, the embodiments of the present application send heartbeat packets at a non-fixed interval, which can reduce the number of sending and receiving heartbeat packets in a period of time and reduce the resource occupation of the heartbeat protocol. BRIEF DESCRIPTION OF DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed in the embodiment description. Obviously, the drawings in the following description are only some embodiments described in the present application, and other drawings can also be obtained by those skilled in the art according to these drawings.
[0033] It should be noted that although each step in the flowchart (if any) involved in each embodiment is drawn in sequence according to the direction of the arrow, unless explicitly stated herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other sequences. Moreover, at least part of the steps in the flowchart involved in each embodiment can include multiple steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of these steps or stages is not necessarily sequential, but can be executed alternately or alternately with at least part of other steps or steps or stages in other steps.
[0034] Figure 1 A communication diagram for sending a heartbeat packet at a fixed interval in the prior art;
[0035] Figure 2 A communication diagram for sending a heartbeat packet at a non-fixed interval (i.e. irregularly) in an embodiment of the present application;
[0036] Figure 3 A flowchart of a heartbeat protocol control method in an embodiment of the present application;
[0037] Figure 4 A heartbeat packet transmission and reception diagram mixed with an encryption algorithm in an embodiment of the present application;
[0038] Figure 5 A structural diagram of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical scheme and advantages of the present application clearer, the present application will be described in further detail below with reference to the accompanying drawings, and the described embodiments should not be regarded as limiting the present application. All other embodiments obtained by those skilled in the art without making creative efforts fall within the scope of protection of the present application.
[0040] The terms "first", "second", "third", "fourth" and the like (if any) in the specification and claims of the present application and the accompanying drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not necessarily limit to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0041] In the following description, reference is made to "one embodiment" or "one example" or similar expressions, which describe a subset of all possible embodiments. However, it is to be understood that "one embodiment" or "one example" can be a subset of all possible embodiments or a different subset of all possible embodiments, and can be combined with each other, without conflict. In the following description, the term "a plurality" refers to at least two. If a certain numerical value reaches a threshold value (if any), it can include the case where the former is greater than the threshold value in some examples. If "any" or "at least one" or similar expressions are mentioned, it can specifically refer to any one of the listed examples or any combination of these examples.
[0042] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in this application is for the purpose of describing the embodiments of the application only and is not intended to be limiting of the application.
[0043] The embodiments of the application can be mainly used for multi-module communication of devices, for example, can be used for communication between display interaction module, master module and power module and other multi-modules in existing medical devices. Figure 1 As shown in the figure, the existing device module connection normality judgment method is to send a heartbeat protocol package at a fixed time, that is, module 1 can send a heartbeat package to module 2 once every 1s, so as to judge whether the connection between module 1 and module 2 is always normal and effective. However, the existing interaction protocol (such as touch screen point instruction) is staggered with the heartbeat protocol, that is, once the heartbeat protocol is sent, the interaction protocol is sent once, which leads to the need to additionally allocate part of the resources to the heartbeat protocol when the interaction protocol is parsed, thereby causing excessive resource occupation.
[0044] In view of this, the applicant proposes the application scheme, and the method of the application will be further described in detail below.
[0045] Please refer to Figure 2 、 Figure 3 The first aspect of the application provides a specific embodiment of a heartbeat protocol control method, which includes the following operation steps:
[0046] Step S31, after the first module sends a heartbeat package to the second module once, the first module is controlled to send a heartbeat package to the second module again at an indefinite time, so as to judge whether the communication state between the first module and the second module is normal.
[0047] Figure 2 As shown in the figure, module 1 and module 2 can be the receiving end and the sending end of each other, that is, it can not be limited which module is simply used as the receiving end or the sending end of the heartbeat package.
[0048] For the form of fixed interval sending heartbeat packet in the prior art, assuming that the fixed sending time interval of the heartbeat packet is 500 ms, then it will appear that the interactive protocol content is also sent at the same time when the heartbeat packet is sent, which will cause the two protocol data to be mixed together, resulting in a decrease in parsing efficiency. In contrast, the heartbeat packet is sent at an unspecified interval in the embodiments of the application, for example, the interactive protocol is sent at least once or not at all in a certain time interval of sending the heartbeat protocol, which can reduce the number of times of sending and receiving the heartbeat packet in a period of time, greatly reduce the number of times of the above-mentioned situation (i.e. the two protocol data are mixed together), and reduce the resource occupation of the heartbeat protocol.
[0049] On the basis of the above example, some specific possible implementation examples will be provided below. In actual application, the implementation contents of these examples can be combined or implemented alone according to the corresponding functional principles and application logic. If combined, the execution order of the combined examples can be determined according to the respective processing logic, and the specific execution order can be determined according to the actual scene.
[0050] In some specific examples, the operation of "controlling the first module to send the heartbeat packet to the second module again at an unspecified time after the first module sends the heartbeat packet to the second module once" in step S31 can specifically include (determining the next sending time of the heartbeat packet based on the judgment of whether there is a non-heartbeat protocol in the previous period): detecting whether there is communication between the first module and the second module based on the non-heartbeat protocol within a preset time interval after the first module sends the heartbeat packet to the second module; if there is, controlling the first module to send the heartbeat packet to the second module again after the communication time is delayed by a preset time interval; and if there is not, controlling the first module to send the heartbeat packet to the second module again immediately.
[0051] For example, when the device is in a working state, if it is detected that there is a normal interactive protocol in the communication between the modules in each adjacent preset time interval (which can be 1 s), it can be defaulted that the modules are working normally, and at this time the heartbeat packet can be defaulted not to be sent, but the heartbeat packet is sent after the (latest) communication time of the interactive protocol is delayed by at least one preset time interval. On the contrary, if it is not detected that there is a normal interactive protocol in the communication between the modules in 1 s, the heartbeat packet is sent once immediately to verify whether the communication between the modules is normal as soon as possible.
[0052] It can be understood that although the interaction protocol is detected every 1s, it is impossible to determine whether the modules are actually normally connected, and it still needs to be determined through the receiving and sending of the heartbeat protocol. In order to reduce resource occupation, it can be defined that as long as there is an interaction protocol, it can be considered that the modules are normally connected and work. Therefore, in terms of actual situation, the embodiment of the application only reduces the number of times of receiving and sending the heartbeat protocol in a period of time, thereby reducing resource occupation, and the heartbeat protocol cannot be abandoned.
[0053] In some specific examples, if the device is in a standby state, the heartbeat protocol can be sent every 1s to ensure that the connection between the modules is valid.
[0054] As can be seen from the above description, the heartbeat interval time in the embodiment of the application is not fixed. In some specific examples, the heartbeat interval range (i.e. the above-mentioned preset time interval) can be any length of time within 100ms to 1200ms, which can be determined by actual situation and is not limited here. Among them, from the experimental results of the existing medical device, the preferred range of the preset time interval of this device can be any length of time within 1000ms to 1200ms.
[0055] As a possible implementation, the operation of "controlling the first module to send the heartbeat packet to the second module again after the preset time interval is sequentially delayed from the communication time" can specifically include: if it is detected that there is still communication between the first module and the second module within the preset time interval after being sequentially delayed once, the sending time of the heartbeat packet is sequentially delayed again, and when the sending time is sequentially delayed for a preset number of times, the first module is controlled to send the heartbeat packet to the second module again.
[0056] Taking 1s as an example of the preset time interval, if there is communication of other protocols (such as interaction protocols) within 1200ms after sending the heartbeat protocol once, it can be considered that the modules between the heartbeat protocols are normally working, and the heartbeat protocol can be sequentially executed again after 1s. Among them, the above-mentioned preset number of times can be any number of times within 2 to 5 times, taking 3 times as an example, if the interaction protocol communication is relatively frequent, 3 times of heartbeat sequential delay can be continuously triggered, and when the third time of heartbeat sequential delay is triggered, the heartbeat protocol is sent once to ensure that the heartbeat is normal, and the above-mentioned process is repeated. In other words, the maximum sequential delay can be set to 3 times, and the heartbeat protocol is sent once by default after the fourth time, that is, if the interaction protocol is detected every second within the previous 3s, the heartbeat protocol is sent at the 4th second by default, thereby effectively reducing the number of times of sending the heartbeat protocol and reducing the occupation of resources.
[0057] In short, the heartbeat packet sending timing of the embodiment of the present application can be flexibly determined based on whether there is a non-heartbeat protocol in the preceding period, that is, by determining whether there is a non-heartbeat protocol, it is determined whether the subsequent heartbeat packet is sent with a delay or immediately. In this way, the heartbeat protocol is sent in the form of a non-fixed interval, which can be distinguished from the fixed interval sending in the prior art, and the effect that can be achieved is to reduce resource occupation.
[0058] It should be noted that in the embodiment of the present application, whether the actual connection between the modules is normal or needs to be determined by the heartbeat protocol, the above-mentioned delay is actually a "hypothetical" interaction protocol before the default connection is normal, but in fact whether it is really a normal connection needs to be confirmed by the heartbeat protocol. Compared with the fixed sending form of the heartbeat protocol in the prior art, the heartbeat protocol is sent at an indefinite time in the embodiment of the present application, which can greatly reduce the number of times of receiving and sending multiple protocols in an interleaved manner, so as to avoid affecting the protocol parsing efficiency. For example, only when the preset delay times are reached, such as 3 times of delay, the heartbeat protocol will be sent, but if there is an interaction protocol at the same time, it will still affect the protocol parsing efficiency.
[0059] Different from the above-mentioned flexible determination of the sending timing of the heartbeat packet based on whether there is a non-heartbeat protocol in the preceding period, as another possible implementation, the specific operation of step S31 can include: taking the time of the last sending of the heartbeat packet as the starting point, and sending the heartbeat packet again to the second module after a random interval each time.
[0060] Specifically, the time of the last sending of the heartbeat packet can be taken as the starting point, and the heartbeat packet can be sent at a random interval each time, that is, the difference between the time intervals of adjacent two times of sending the heartbeat packet can be unlimited, such as can not be affected by whether there is a non-heartbeat protocol in the preceding period, so that the sending time of the interaction protocol can be staggered to a certain extent, the number of chaotic times of simultaneous receiving and sending of the heartbeat protocol and the interaction protocol is reduced, and the protocol parsing efficiency is avoided.
[0061] Please refer to the following description, the present application also proposes that the encryption algorithm can be mixed in the heartbeat packet, so as to improve the difficulty of identifying and cracking the protocol content and protect the information security.
[0062] Based on Figure 2 , Figure 3 In some specific examples, the method of the embodiment of the present application can also include mixing random data into the heartbeat packet, so that the second module verifies the identity of the first module by encrypting or decrypting the random data.
[0063] For example Figure 4As shown, random data (which can be used as a key) can be added in the transmitted heartbeat packet, and the random data can be added at any position in the heartbeat packet. The random data can be characters randomly assigned by the device or instrument, and the random data added each time can be the same or different, and the specific implementation is not limited. Still taking Figure 4 For example, module 1 can send a heartbeat packet mixed with random data to module 2. After receiving the heartbeat packet, module 2 can use a known conversion formula to convert (which can be regarded as encryption) “random number 1” and “random number 2” to obtain “ciphertext 1” and “ciphertext 2” and return them to module 1. Module 1 can subsequently use a known conversion formula to calculate the result converted from “random number 1” and “random number 2”, and determine whether the result is consistent with the returned “ciphertext 1” and “ciphertext 2”. If they are consistent, it can be considered that the communication transmission is legal, because only a legitimate receiver with the correct conversion algorithm and random data can obtain the expected result. If the conversion result does not match the expectation, there may be a security problem, such as key leakage or encryption algorithm cracking.
[0064] As can be seen, there is a corresponding relationship between the random data and the ciphertext due to the conversion. The two ends of the communication transmission can confirm the legality of the communication transmission between the two ends by comparing the ciphertext with the conversion result. The conversion formula can be a cyclic redundancy check-32 (CRC32, Cyclic Redundancy Check 32) or an Adler-32 checksum algorithm.
[0065] Of course, it is different from Figure 4 In this case, the receiving end can decrypt the received random data using a known conversion formula. If the decryption result returned to the sending end is consistent with the decryption result known to the sending end, it can be considered that the communication transmission is legal, otherwise it can be prompted that the communication is illegal. In summary, the two parties of the communication transmission can verify whether their decryption data is consistent, or whether their encryption results are consistent, to ensure the authenticity of the two parties of the communication.
[0066] In some specific examples, the method of the embodiment of the application can further include: if the communication state has been correctly determined through the preset number of times of sending heartbeat packets, mixing new random data in the next heartbeat packet to be sent; the new random data is different from the random data in the heartbeat packet of the preset number of times.
[0067] For example, the heartbeat random number can be updated when the fourth heartbeat packet is to be sent after each three times of successful communication transmission of the heartbeat packet. In this way, the protocol data can be more flexible and unpredictable, and the cracking difficulty can be increased. The random data obtained each time is different from the previous random data in at least part or all of the contained data.
[0068] In some specific examples, the method of the embodiments of the application can further include: mixing random data into the heartbeat packet as a password element of the non-heartbeat protocol to enhance the difficulty of cracking the content of the non-heartbeat protocol when communicated between the first module and the second module.
[0069] For example, the random data mixed into the heartbeat packet can be used as a password element of the interactive protocol to enhance the randomness of the interactive protocol and increase the difficulty of cracking it. The random data used by the interactive protocol can be the same as or different from the random data in the last heartbeat packet. Similarly, the random data used by the interactive protocol can be updated after n times, for example, the random data used by the interactive protocol is updated when the fourth sending is performed after the third heartbeat protocol and / or interactive protocol transmission is successful, so that the interactive protocol data is more flexible and unpredictable, and the password level is improved. Of course, similarly, the ciphertext data obtained by converting the random data can also be used as one of the password elements of the interactive protocol, which is not limited here.
[0070] In terms of actual scenarios, module 1 sends a control instruction to module 2, and at least part of the content of the heartbeat protocol can be added into the data in the instruction. If the heartbeat protocol is in the extension period, the heartbeat protocol content added in the control instruction is the content that has not been updated last time (this content can contain random data). If the heartbeat protocol is extended for a preset number of times, the heartbeat protocol content added in the control instruction is the new content after the change
[0071] In summary, the existing fixed heartbeat communication logic has problems such as interlacing of the heartbeat protocol and the interactive protocol, easy identification and cracking of the protocol content, affecting the synchronization efficiency, and security risks. In contrast, the mixed encryption indefinite heartbeat communication logic of the embodiments of the application improves the communication efficiency, increases the cracking difficulty, and improves the software security. The use of the mixed encryption logic and / or the indefinite heartbeat communication logic of the embodiments of the application is within the protection scope of the patent.
[0072] Specifically, the heartbeat interval range that can be used is 100ms to 1200ms, the extension number can be 3 times, the mixed encryption algorithm can use 2-bit random number and ciphertext, the conversion formula between the random number and the ciphertext can be specified, and the random number can be updated after 3 times of heartbeat interaction without error. According to the design idea of the patent, the heartbeat interval range, the extension number, the number of random data and ciphertext, the random number update interval, the self-defined conversion formula (such as weighted combination of multiple conversion formulas) can be adjusted to achieve the same implementation effect as the patent.
[0073] Compared with Figure 3The examples shown above illustrate that the examples or possible implementations described above do not necessarily have to be implemented in the specific manner described, and that, for example, two or more of the examples or possible implementations described above can be combined or implemented separately, and that the order of implementation of the examples combined can be determined according to the respective processing logic, and can be determined according to the actual situation.
[0074] The second aspect of the present application provides a specific embodiment of a heartbeat protocol control system, which comprises a processing unit.
[0075] The processing unit is configured to, after the first module sends a heartbeat packet to the second module each time, manipulate the first module to send a heartbeat packet to the second module again at an irregular time, so as to determine whether the communication state between the first module and the second module is normal.
[0076] In some examples, the processing unit is specifically configured to:
[0077] detect whether there is communication between the first module and the second module based on a non-heartbeat protocol within a preset time interval after the first module sends a heartbeat packet to the second module;
[0078] If there is, manipulate the first module to send a heartbeat packet to the second module again after the preset time interval is extended from the communication time;
[0079] If there is not, manipulate the first module to send a heartbeat packet to the second module again immediately.
[0080] In some examples, the preset time interval is any length within 100 ms to 1200 ms.
[0081] In some examples, the processing unit is specifically configured to:
[0082] If it is detected that there is still communication between the first module and the second module within the preset time interval after the extension, extend the sending time of the heartbeat packet again until the sending time is extended for a preset number of times, and then manipulate the first module to send a heartbeat packet to the second module again.
[0083] In some examples, the preset number of times is any number of times within 2 to 5 times.
[0084] In some examples, the processing unit is specifically configured to:
[0085] Each time after a random interval, manipulate the first module to send a heartbeat packet to the second module again, starting from the time of the last sending of the heartbeat packet.
[0086] In some examples, the processing unit is further configured to:
[0087] Mixing random data into the heartbeat packet to make the second module verify the identity of the first module by encrypting or decrypting the random data.
[0088] In some examples, the processing unit is further configured to:
[0089] If the communication state is correctly determined by the heartbeat packet sent for the preset number of times, new random data is mixed into the heartbeat packet sent next time for the preset number of times; the new random data is different from the random data in the heartbeat packet for the preset number of times.
[0090] In some examples, the processing unit is further configured to:
[0091] The random data is used as a password element of the non-heartbeat protocol to enhance the difficulty of cracking the content of the non-heartbeat protocol when communicated between the first module and the second module.
[0092] In summary, the embodiments of the present application can use heartbeat packets with indefinite time and flexible heartbeat logic mixed with encryption algorithms. Among them, the indefinite time transmission makes the heartbeat logic more flexible, avoids the interlacing with other interaction protocols, and improves the synchronization efficiency; in addition, the heartbeat packet mixed with the encryption algorithm can make the protocol content not be in a fixed format, increase the cracking difficulty, and improve the software security.
[0093] In the embodiments of the present application, the operations performed by the units of the heartbeat protocol control system are similar to the operations described in the foregoing first aspect or any specific method embodiment of the first aspect, and will not be repeated here. Of course, the specific implementation process of each operation of the first aspect of the present application can also be realized by referring to the related description of the second aspect.
[0094] Please refer to Figure 5 The electronic device 500 of the embodiments of the present application can include one or more processors (such as central processing units CPU) 501 and a memory 505, and the memory 505 stores one or more application programs or data.
[0095] The memory 505 can be volatile storage or persistent storage. The program stored in the memory 505 can include one or more modules, and each module can include a series of instruction operations in the electronic device. Further, the processor 501 can be configured to communicate with the memory 505 and execute a series of instruction operations in the memory 505 on the electronic device 500.
[0096] The electronic device 500 can also include one or more power supplies 502, one or more wired or wireless network interfaces 503, one or more input / output interfaces 504, and / or one or more operating systems, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0097] The processor 501 can perform operations performed by the first aspect or any of the implementation forms of the first aspect, and details are not repeated here.
[0098] The present application provides a computer readable storage medium, comprising instructions, when the instructions are executed on a computer, the computer executes the method described in the first aspect or any of the implementation forms of the first aspect.
[0099] The present application provides a computer program product comprising instructions or a computer program, when the computer program product is executed on a computer, the computer executes the method described in the first aspect or any of the implementation forms of the first aspect.
[0100] It can be understood that, in various embodiments of the present application, the sequence of the steps does not mean the order of execution, the execution order of the steps should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. The operation content added or refined by each example scheme of the above method, system or device (if any) does not necessarily need to be executed in specific implementation, such as adding more than two operations, which can be combined or implemented separately, and the specific implementation can be determined according to the actual scene.
[0101] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above described system (if any) and device can refer to the corresponding process in the foregoing method embodiment, which is not repeated here.
[0102] In several embodiments provided by the present application, it should be understood that the disclosed apparatus and method can be implemented by other means. For example, the above-described device embodiment is only schematic, for example, the division of the unit is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system or device, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the shown or discussed each other can be indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other form.
[0103] The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0104] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present alone, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0105] The integrated unit, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on such understanding, the technical scheme of the present application essentially or the part that contributes to the prior art or the whole or part of the technical scheme can be embodied in the form of a software product. The computer software product (or computer program product) stored in a storage medium includes a plurality of instructions for causing a computer device (which can be a personal computer, a business server or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, read-only memory), a random access memory (RAM, random access memory), a magnetic disk or an optical disk, and various program code storage media.
Claims
1. A heartbeat protocol control method, characterized by, The first module and the second module applied to the whole machine equipment, comprising: After the first module sends a heartbeat packet to the second module each time, the first module is controlled to send a heartbeat packet to the second module again at an uncertain time to determine whether the communication state between the first module and the second module is normal.
2. The heartbeat protocol control method according to claim 1, wherein After the first module sends a heartbeat packet to the second module each time, the first module is controlled to send a heartbeat packet to the second module again at an uncertain time, comprising: Within a preset time interval after the first module sends a heartbeat packet to the second module, it is detected whether there is a communication based on a non-heartbeat protocol between the first module and the second module; If there is, after the communication time as a starting point and the preset time interval is extended, the first module is controlled to send a heartbeat packet to the second module again; If there is not, the first module is immediately controlled to send a heartbeat packet to the second module again.
3. The heartbeat protocol control method according to claim 2, wherein The preset time interval is any length within 100ms to 1200ms.
4. The heartbeat protocol control method according to claim 2, wherein After the communication time as a starting point and the preset time interval is extended, the first module is controlled to send a heartbeat packet to the second module again, comprising: Within the preset time interval after the extension, if it is detected that the communication between the first module and the second module still exists, the sending time of the heartbeat packet is extended again until the sending time is extended for a preset number of times, and the first module is controlled to send a heartbeat packet to the second module again.
5. The heartbeat protocol control method according to claim 4, wherein The preset number of times is any number within 2 to 5 times.
6. The heartbeat protocol control method of claim 1, wherein, After the first module sends a heartbeat packet to the second module each time, the first module is controlled to send a heartbeat packet to the second module again at an uncertain time, comprising: The time of the last heartbeat packet is taken as a starting point, and after a random interval each time, the first module is controlled to send a heartbeat packet to the second module again.
7. The heartbeat protocol control method according to any one of claims 1 to 6, characterized by, The method further comprises: Mixing random data into the heartbeat packet, so that the second module verifies the identity of the first module by encrypting or decrypting the random data.
8. The heartbeat protocol control method according to claim 7, wherein The method further comprises: If the communication state has been correctly determined by a preset number of times of sending heartbeat packets, new version random data is mixed into the next time of sending heartbeat packets; the new version random data is different from the random data in the preset number of times of heartbeat packets.
9. The heartbeat protocol control method according to claim 7, wherein The method further comprises: The random data is used as a non-heartbeat protocol password element to enhance the difficulty of cracking the content of the non-heartbeat protocol when communicating between the first module and the second module.
10. A heartbeat protocol control system, characterized by Comprising: A processing unit; The processing unit is used to control the first module to send a heartbeat packet to the second module again at an uncertain time after the first module sends a heartbeat packet to the second module each time to determine whether the communication state between the first module and the second module is normal.
11. An electronic device, comprising: Comprising: A processor and a memory; The processor is configured to communicate with the memory and execute instructions in the memory to implement the method of any one of claims 1 to 9.
12. A readable storage medium, characterized by, The readable storage medium stores computer instructions, and the computer instructions are executed by the processor to implement the method in any one of claims 1 to 9.
13. A computer program product, characterised in that, The computer program product comprises computer instructions, and the computer instructions are executed by the processor to implement the method in any one of claims 1 to 9.
Citation Information
Patent Citations
Network communication control method and device, communication equipment and storage medium
CN111031598A
Robot state information updating method and device, server and storage medium
CN111078267A
Communication method and device and computer readable storage medium
CN111698098A
Method and system for dynamically adjusting heartbeat mechanism time interval, computer program and storage medium
CN112671924A
Heartbeat proxy method and device
CN114126014A