Two-way communication control method, computer readable storage medium and computer device

Through grpc bidirectional streaming long connection and coroutine management, the problem of probe connection management under high concurrent connection is solved, and the stable and efficient management of probe connections is achieved.

CN114710430BActive Publication Date: 2024-11-12SHENZHEN YISHIHUOLALA TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202210356584.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-06
Publication Date
2024-11-12
Estimated Expiration
2042-04-06

AI Technical Summary

Technical Problem

Under high concurrent connections, managing probe agent connections through multiple stream channels can easily cause too many server handles, making it difficult to manage probe connections.

Method used

GRPB bidirectional streaming long connection is adopted, and the probe automatically connects to the server and maintains a long connection. The probe connection is managed through message reception, processing and sending coroutines and data queues to avoid too many server handles.

Benefits of technology

It realizes effective management of probe connections under high concurrent connections, reduces the number of server handles, and facilitates the management of probe connections and data collection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114710430B_ABST
    Figure CN114710430B_ABST
Patent Text Reader

Abstract

The present application is applicable to the field of communication, and provides a two-way communication management and control method, a computer-readable storage medium, and a computer device, including: configuring a probe; using the probe to connect to a server according to the domain name of the server, and establishing a grpc two-way streaming long connection with the server; receiving instructions sent by the server through the grpc two-way streaming connection; collecting data and sending the data to the server through the grpc two-way streaming connection. This facilitates the communication and management of the probe.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communications, and in particular to a two-way communication control method, a computer-readable storage medium, and a computer device. Background Art

[0002] In the host security system, it is necessary to deploy a security probe agent in the business server. The communication framework does not involve security capabilities, which are the core basic capabilities of the client and determine the stability of the entire system. However, managing probe agent connections through multiple streaming channels in parallel can easily cause too many server handles under high concurrent connections, making it difficult to manage probe agent connections. Summary of the invention

[0003] The purpose of this application is to provide a two-way communication management and control method, a computer-readable storage medium and a computer device, aiming to solve the problem that managing probe connections through multiple streaming channels may easily cause too many server handles under high concurrency connections and make it difficult to manage probe connections.

[0004] In a first aspect, the present application provides a two-way communication management and control method, comprising:

[0005] Configure the probe;

[0006] Use the probe to connect to the server according to the server's domain name and establish a grpc bidirectional streaming long connection with the server;

[0007] Receive instructions sent by the server through grpc bidirectional streaming connection;

[0008] Collect data and send it to the server through a grpc bidirectional streaming connection.

[0009] Furthermore, before receiving the instruction sent by the server through the grpc bidirectional streaming connection, it also includes:

[0010] Use the registered message processing function to perform operations according to the received instructions;

[0011] Start the message receiving coroutine, message processing coroutine and message sending coroutine, and establish data reading queue and writing queue.

[0012] Furthermore, the message processing function includes a data channel function and a control channel function.

[0013] Furthermore, the instructions sent by the server are received through the grpc bidirectional streaming connection as follows: the message receiving coroutine waits to receive the upgrade, restart, or rollback instructions sent by the server of the grpc bidirectional streaming connection, sends the received instructions to the read queue, and the information processing coroutine unpacks the instructions, splits the head data, and processes the body data using the control channel.

[0014] Furthermore, the collecting of data and sending the data to the server through the grpc bidirectional streaming connection is specifically as follows: the probe collects the client data, uses the data channel to encapsulate the client data into msg-data and writes it into the write queue, and then sends it to the server through the grpc bidirectional streaming connection.

[0015] Furthermore, the data of the message receiving coroutine, the message processing coroutine and the message sending coroutine are head data and body data.

[0016] Furthermore, the body data is in protobuf format.

[0017] In a second aspect, the present application provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, it implements the steps of the two-way communication control method described in the first aspect.

[0018] In a third aspect, the present application provides a computer device comprising: one or more processors, a memory, and one or more computer programs, the processor and the memory being connected via a bus, wherein the one or more computer programs are stored in the memory and are configured to be executed by the one or more processors, and when the processor executes the computer program, the steps of the two-way communication control method described in the first aspect are implemented.

[0019] In a fourth aspect, the present application provides a two-way communication management and control method, including:

[0020] Connect to the probe configured by the client and establish a grpc bidirectional streaming long connection with the probe;

[0021] Send instructions to the probe via a grpc bidirectional streaming connection;

[0022] Get the collected data sent by the probe through the grpc bidirectional streaming connection.

[0023] In a fifth aspect, the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps of the two-way communication control method described in the fourth aspect.

[0024] In the sixth aspect, the present application provides a computer device, comprising: one or more processors, a memory, and one or more computer programs, the processor and the memory are connected via a bus, wherein the one or more computer programs are stored in the memory and are configured to be executed by the one or more processors, and when the processor executes the computer program, the steps of the two-way communication control method described in the fourth aspect are implemented.

[0025] In this application, the configured probe establishes a grpc bidirectional streaming long connection with the server. The probe will automatically connect to the server and maintain a long connection communication with the server. It will not cause too many server handles and facilitate the management of probe connections. The server only needs to send command messages and wait for the probe to collect data. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 It is a flowchart of a two-way communication control method provided in one embodiment of the present application.

[0027] Figure 2 It is a specific structural block diagram of a computer device provided in one embodiment of the present application.

[0028] Figure 3 It is a flowchart of a two-way communication control method provided by another embodiment of the present application.

[0029] Figure 4 It is a specific structural block diagram of a computer device provided in another embodiment of the present application. DETAILED DESCRIPTION

[0030] In order to make the purpose, technical solution and beneficial effects of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0031] In order to illustrate the technical solution described in this application, a specific embodiment is provided below for illustration.

[0032] See also Figure 1 , a two-way communication control method provided in an embodiment of the present application includes the following steps: It should be noted that if there are substantially the same results, the two-way communication control method of the present application is not based on Figure 1 The process sequence shown is limited.

[0033] S101, configure the probe;

[0034] S102, using the probe to connect to the server according to the server's domain name, and establishing a grpc bidirectional streaming long connection with the server;

[0035] S103, receiving instructions sent by the server through the grpc bidirectional streaming connection;

[0036] S104, collect data and send the data to the server through the grpc bidirectional streaming connection.

[0037] In an embodiment of the present application, before receiving the instruction sent by the server through the grpc bidirectional streaming connection, it also includes:

[0038] Use the registered message processing function to perform operations according to the received instructions;

[0039] Start the message receiving coroutine, message processing coroutine and message sending coroutine, and establish data reading queue and writing queue.

[0040] In one embodiment of the present application, the message processing function includes a data channel function and a control channel function.

[0041] In one embodiment of the present application, the instructions sent by the server are received through the grpc bidirectional streaming connection as follows: the message receiving coroutine waits to receive the upgrade, restart, or rollback instructions sent by the server of the grpc bidirectional streaming connection, sends the received instructions to the read queue, and the information processing coroutine unpacks the instructions, splits the head data, and uses the control channel to process the body data.

[0042] In one embodiment of the present application, the data collection and sending of the data to the server through the grpc bidirectional streaming connection is specifically as follows: the probe collects the client data, uses the data channel to encapsulate the client data into msg-data and writes it into the write queue, and then sends it to the server through the grpc bidirectional streaming connection.

[0043] In one embodiment of the present application, the data of the message receiving coroutine, the message processing coroutine and the message sending coroutine are head data and body data.

[0044] The header data is in a custom format and includes channel, message group, message content, and message version.

[0045] In one embodiment of the present application, the body data is in protobuf format.

[0046] An embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps of the two-way communication control method provided in an embodiment of the present application are implemented.

[0047] Figure 2A specific structural block diagram of a computer device provided in an embodiment of the present application is shown, wherein a computer device 100 comprises: one or more processors 101, a memory 102, and one or more computer programs, wherein the processor 101 and the memory 102 are connected via a bus, the one or more computer programs are stored in the memory 102, and are configured to be executed by the one or more processors 101, and when the processor 101 executes the computer program, the steps of the method for controlling bidirectional communication provided in an embodiment of the present application are implemented.

[0048] The computer device includes a server and a terminal, etc. The computer device may be a desktop computer, a mobile terminal or a vehicle-mounted device, and the mobile terminal includes at least one of a mobile phone, a tablet computer, a personal digital assistant or a wearable device, etc.

[0049] In an embodiment of the present invention, the configured probe establishes a grpc bidirectional streaming long connection with the server. The probe will automatically connect to the server and maintain long connection communication with the server. This will not cause too many server handles and facilitate the management of probe connections. The server only needs to send command messages and wait for the probe to collect data.

[0050] See also Figure 3 Another embodiment of the present application provides a two-way communication management and control method, including:

[0051] S201, connect to the probe configured by the client, and establish a grpc bidirectional streaming long connection with the probe;

[0052] S202, sending the command to the probe through the grpc bidirectional streaming connection;

[0053] S203. Obtain the collected data sent by the probe through the grpc bidirectional streaming connection.

[0054] Another embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps of the two-way communication control method provided in one embodiment of the present application.

[0055] Figure 4 A specific structural block diagram of a computer device provided in another embodiment of the present application is shown, wherein a computer device 200 includes: one or more processors 201, a memory 202, and one or more computer programs, wherein the processor 201 and the memory 202 are connected via a bus, the one or more computer programs are stored in the memory 202, and are configured to be executed by the one or more processors 201, and when the processor 201 executes the computer program, the steps of the two-way communication control method provided in an embodiment of the present application are implemented.

[0056] The computer device includes a server and a terminal, etc. The computer device may be a desktop computer, a mobile terminal or a vehicle-mounted device, and the mobile terminal includes at least one of a mobile phone, a tablet computer, a personal digital assistant or a wearable device, etc.

[0057] In an embodiment of the present invention, a grpc bidirectional streaming long connection is established with the probe, and the server only needs to send a command message and wait for data collection by the probe.

[0058] A person skilled in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.

[0059] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims

1. A two-way communication control method, characterized in that: The method is applied to a client and includes: Configure the probe; Use the probe to automatically connect to the server based on the server's domain name and establish a grpc bidirectional streaming long connection with the server; Receive instructions sent by the server through grpc bidirectional streaming connection; Collect data and send it to the server through a grpc bidirectional streaming connection; Before receiving the instruction sent by the server through the grpc bidirectional streaming connection, the method further includes: Use the registered message processing function to perform operations according to the received instructions; Start the message receiving coroutine, message processing coroutine and message sending coroutine, and establish data reading queue and writing queue.

2. The control method according to claim 1, characterized in that: The message processing function includes a data channel and a control channel.

3. The control method according to claim 1, characterized in that: The receiving instruction sent by the server through the grpc bidirectional streaming connection is specifically as follows: the message receiving coroutine waits to receive the upgrade, restart, or rollback instruction sent by the server of the grpc bidirectional streaming connection, sends the received instruction to the read queue, and the information processing coroutine unpacks the instruction, splits the head data, and processes the body data using the control channel.

4. The control method according to claim 1, characterized in that: The collecting of data and sending the data to the server through the grpc bidirectional streaming connection is specifically as follows: the probe collects the client data, uses the data channel to encapsulate the client data into msg-data and writes it into the write queue, and then sends it to the server through the grpc bidirectional streaming connection.

5. The control method according to claim 1, characterized in that: The data of the message receiving coroutine, the message processing coroutine and the message sending coroutine are head data and body data.

6. The control method according to claim 5, characterized in that: The body data is in protobuf format.

7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the two-way communication control method according to any one of claims 1 to 6 are implemented.

8. A computer device comprising: One or more processors, a memory and one or more computer programs, the processor and the memory are connected via a bus, wherein the one or more computer programs are stored in the memory and are configured to be executed by the one or more processors, characterized in that when the processor executes the computer program, the steps of the two-way communication control method as described in any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Data transmission method, device and equipment based on grpc framework

    CN110177127A

  • Method for realizing comprehensive treatment working end system communication based on grpc and probuf

    CN110321237A

  • Micro-service full-link monitoring system and method thereof

    CN111464373A

  • Data transmission method and device, electronic equipment and storage medium

    CN112887413A

  • Full-link monitoring system and method based on big data

    CN112910733A