CN114710430A - Bidirectional communication control method, computer readable storage medium and computer device - Google Patents

Bidirectional communication control method, computer readable storage medium and computer device Download PDF

Info

Publication number
CN114710430A
CN114710430A CN202210356584.0A CN202210356584A CN114710430A CN 114710430 A CN114710430 A CN 114710430A CN 202210356584 A CN202210356584 A CN 202210356584A CN 114710430 A CN114710430 A CN 114710430A
Authority
CN
China
Prior art keywords
data
grpc
probe
bidirectional
server
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210356584.0A
Other languages
Chinese (zh)
Inventor
周峤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Yishi Huolala Technology Co Ltd
Original Assignee
Shenzhen Yishi Huolala Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Yishi Huolala Technology Co Ltd filed Critical Shenzhen Yishi Huolala Technology Co Ltd
Priority to CN202210356584.0A priority Critical patent/CN114710430A/en
Publication of CN114710430A publication Critical patent/CN114710430A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/12Network monitoring probes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/28Restricting access to network management systems or functions, e.g. using authorisation function to access network configuration
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/142Managing session states for stateless protocols; Signalling session states; State transitions; Keeping-state mechanisms

Abstract

The application is applicable to the field of communication, and provides a bidirectional communication management and control method, a computer readable storage medium and computer equipment, which comprise: configuring a probe; connecting the server side by using the probe according to the domain name of the server side, and establishing grpc bidirectional flow type long connection with the server side; receiving an instruction sent by a server side through a grpc bidirectional streaming connection; collect data and send data to the server over a grpc bi-directional streaming connection. Communication and management of the probe is facilitated.

Description

Bidirectional communication control method, computer readable storage medium and computer device
Technical Field
The present application belongs to the field of communications, and in particular, to a method for managing and controlling bidirectional communications, a computer-readable storage medium, and a computer device.
Background
In the host security system, a security probe agent needs to be deployed in a service server, and a communication framework does not relate to security capability, is the core basic capability of a client and determines the stability of the whole system. However, managing the probe agent connections through multiple streaming channels in parallel easily causes too many service handles under high concurrent connections, and is not easy to manage the probe agent connections.
Disclosure of Invention
The application aims to provide a bidirectional communication management and control method, a computer readable storage medium and computer equipment, and aims to solve the problems that probe connection is managed through multiple streaming channels, too many handles are easily caused at a server side under high concurrent connection, and probe connection is not easily managed.
In a first aspect, the present application provides a method for managing and controlling bidirectional communication, including:
configuring a probe;
connecting the server side by using the probe according to the domain name of the server side, and establishing grpc bidirectional flow type long connection with the server side;
receiving an instruction sent by a server side through a grpc bidirectional streaming connection;
collect data and send data to the server over a grpc bi-directional streaming connection.
Further, before receiving the instruction sent by the server through the grpc bidirectional streaming connection, the method further includes:
executing operation according to the received instruction by using the registered message processing function;
and starting a message receiving coroutine, a message processing coroutine and a message sending coroutine, and establishing a data reading queue and a data writing queue.
Further, the message processing function includes a data channel function and a control channel function.
Further, the receiving of the instruction sent by the service end through the grpc bidirectional streaming connection specifically includes: the message receiving coroutine waits for receiving an upgrading, restarting or rollback instruction sent by a service end in a grpc bidirectional streaming connection, sends the received instruction to a read queue, unpacks the instruction by the information processing coroutine, splits the head data and processes the body data by using a control channel.
Further, the collecting data and sending the data to the server through the grpc bidirectional streaming connection specifically includes: the probe collects client data, the client data is packaged into msg-data by a data channel and written into a write queue, and the msg-data is sent to a server through grpc bidirectional streaming connection.
Further, the data of the message receiving protocol, the message processing protocol and the message sending protocol are head data and body data.
Further, the body data is in protobuf format.
In a second aspect, the present application provides a computer-readable storage medium storing a computer program which, when executed by a processor, implements the steps of the method for managing bidirectional communication of the first aspect.
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 processors and the memory being connected by a bus, wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, the processors when executing the computer programs implementing the steps of the method of governing two-way communication of the first aspect.
In a fourth aspect, the present application provides a method for managing and controlling bidirectional communication, including:
connecting a probe configured at a client side, and establishing grpc bidirectional flow type long connection with the probe;
sending instructions to the probe over a grpc bi-directional streaming connection;
and acquiring the acquired data sent by the probe through grpc bidirectional flow connection.
In a fifth aspect, the present application provides a computer-readable storage medium storing a computer program which, when executed by a processor, implements the steps of the method for regulating bidirectional communication of the fourth aspect.
In a sixth aspect, the present application provides a computer device comprising: one or more processors, a memory, and one or more computer programs, the processors and the memory being connected by a bus, wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, which when executing the computer programs implement the steps of the governing method of bidirectional communication of the fourth aspect.
In the application, the configured probe establishes grpc bidirectional flow type long connection with the server, the probe can be automatically connected with the server, long connection communication with the server is kept, too many handles of the server cannot be caused, probe connection is convenient to manage, and the server only needs to issue an instruction message and wait for data acquisition of the probe.
Drawings
Fig. 1 is a flowchart of a method for managing bidirectional communication according to an embodiment of the present application.
Fig. 2 is a block diagram illustrating a specific structure of a computer device according to an embodiment of the present disclosure.
Fig. 3 is a flowchart of a method for managing bidirectional communication according to another embodiment of the present application.
Fig. 4 is a block diagram of a specific structure of a computer device according to another embodiment of the present application.
Detailed Description
In order to make the purpose, technical solution and beneficial effects of the present application more clear and more obvious, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
In order to explain the technical solution described in the present application, the following description will be given by way of specific examples.
Referring to fig. 1, a method for managing and controlling two-way communication according to an embodiment of the present application includes the following steps: it should be noted that, if the result is substantially the same, the method for managing bidirectional communication in the present application is not limited to the flow sequence shown in fig. 1.
S101, configuring a probe;
s102, connecting a server by using a probe according to a domain name of the server, and establishing grpc bidirectional flow type long connection with the server;
s103, receiving an instruction sent by a server through grpc bidirectional streaming connection;
and S104, collecting data and sending the data to the server side through the grpc bidirectional streaming connection.
In an embodiment of the present application, before receiving the instruction sent by the server through the grpc bidirectional streaming connection, the method further includes:
executing operation according to the received instruction by using the registered message processing function;
and starting a message receiving coroutine, a message processing coroutine and a message sending coroutine, and establishing a data reading queue and a data writing queue.
In an embodiment of the present application, the message processing function includes a data channel function and a control channel function.
In an embodiment of the present application, the receiving, by a grpc bidirectional streaming connection, an instruction sent by a server is specifically: the message receiving coroutine waits for receiving an upgrading, restarting or rollback instruction sent by a service end in a grpc bidirectional streaming connection, sends the received instruction to a read queue, unpacks the instruction by the information processing coroutine, splits the head data and processes the body data by using a control channel.
In an embodiment of the present application, the collecting data and sending the data to the server through the grpc bi-directional streaming connection specifically includes: the probe collects client data, the client data is packaged into msg-data by a data channel and written into a write queue, and the msg-data is sent to a server through grpc bidirectional streaming connection.
In an embodiment of the present application, the data of the message receiving protocol, the message processing protocol and the message sending protocol are head data and body data.
The Head data is in a custom format and comprises channels, message groups, message contents, message versions and the like.
In an embodiment of the present application, the body data is in protobuf format.
An embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program implements the steps of the bidirectional communication management and control method provided by an embodiment of the present application.
Fig. 2 shows a specific block diagram of a computer device provided in an embodiment of the present application, where the computer device 100 includes: one or more processors 101, a memory 102, and one or more computer programs, wherein the processors 101 and the memory 102 are connected by a bus, the one or more computer programs being stored in the memory 102 and configured to be executed by the one or more processors 101, the processor 101 implementing the steps of the governing method of two-way communication as provided by an embodiment of the present application when executing the computer programs.
The computer equipment comprises a server, a terminal and the like. 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.
In the embodiment of the invention, the configured probe establishes grpc bidirectional streaming long connection with the server, the probe can be automatically connected with the server to keep long connection communication with the server, too many handles of the server cannot be caused, the probe connection is convenient to manage, and the server only needs to send an instruction message and wait for data acquisition of the probe.
Referring to fig. 3, another embodiment of the present application provides a method for managing and controlling two-way communication, including:
s201, connecting a probe configured at a client, and establishing grpc bidirectional flow type long connection with the probe;
s202, sending the instruction to the probe through grpc bidirectional flow connection;
and S203, acquiring the acquired data sent by the probe through grpc bidirectional flow connection.
Another embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program implements the steps of the method for managing and controlling two-way communication provided by an embodiment of the present application.
Fig. 4 shows a specific structural block diagram of a computer device provided in another embodiment of the present application, where a computer device 200 includes: one or more processors 201, a memory 202, and one or more computer programs, wherein the processors 201 and the memory 202 are connected by a bus, the one or more computer programs being stored in the memory 202 and configured to be executed by the one or more processors 201, the processor 201, when executing the computer programs, implementing the steps of the governing method of two-way communication as provided by an embodiment of the present application.
The computer equipment comprises a server, a terminal and the like. 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.
In the embodiment of the invention, the grpc bidirectional flow type long connection with the probe is established, and the server only needs to issue an instruction message and wait for data acquisition of the probe.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by associated hardware instructed by a program, which may be stored in a computer-readable storage medium, and the storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (12)

1. A management and control method for bidirectional communication is characterized by comprising the following steps:
configuring a probe;
connecting the server side by using the probe according to the domain name of the server side, and establishing grpc bidirectional flow type long connection with the server side;
receiving an instruction sent by a server side through grpc bidirectional streaming connection;
collect data and send data to the server over a grpc bi-directional streaming connection.
2. The management and control method according to claim 1, wherein before receiving the instruction sent by the server through the grpc bi-directional streaming connection, the method further comprises:
executing operation according to the received instruction by using the registered message processing function;
and starting a message receiving coroutine, a message processing coroutine and a message sending coroutine, and establishing a data reading queue and a data writing queue.
3. The policing method of claim 2, wherein the message handling function comprises a data channel and a control channel.
4. The management and control method according to claim 1, wherein the instruction sent by the grpc bi-directional streaming connection receiving server is specifically: the message receiving coroutine waits for receiving an upgrading, restarting or rollback instruction sent by a service end in a grpc bidirectional streaming connection, sends the received instruction to a read queue, unpacks the instruction by the information processing coroutine, splits the head data and processes the body data by using a control channel.
5. The management and control method according to claim 1, wherein the collecting and sending data to the server via a grpc bi-directional streaming connection is specifically: the probe collects client data, the client data is packaged into msg-data by a data channel and written into a write queue, and the msg-data is sent to a server through grpc bidirectional streaming connection.
6. The method of claim 1, wherein the data of the message receiving protocol, the message processing protocol, and the message sending protocol is head data and body data.
7. The management and control method of claim 6, wherein the body data is in protobuf format.
8. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of a method of governing bidirectional communication according to any one of claims 1 to 7.
9. A computer device, comprising: one or more processors, a memory and one or more computer programs, the processors and the memory being connected by a bus, wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, characterized in that the steps of the governing method of bidirectional communication according to any one of claims 1 to 7 are implemented when the computer programs are executed by the processors.
10. A management and control method for two-way communication is characterized by comprising the following steps:
connecting a probe configured at a client side, and establishing grpc bidirectional flow type long connection with the probe;
sending instructions to the probe over a grpc bi-directional streaming connection;
and acquiring the acquired data sent by the probe through grpc bidirectional flow connection.
11. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method of governing two-way communication according to claim 10.
12. A computer device, comprising: one or more processors, a memory and one or more computer programs, the processors and the memory being connected by a bus, wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, characterized in that the processors, when executing the computer programs, implement the steps of the method of governing bidirectional communication of claim 10.
CN202210356584.0A 2022-04-06 2022-04-06 Bidirectional communication control method, computer readable storage medium and computer device Pending CN114710430A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210356584.0A CN114710430A (en) 2022-04-06 2022-04-06 Bidirectional communication control method, computer readable storage medium and computer device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210356584.0A CN114710430A (en) 2022-04-06 2022-04-06 Bidirectional communication control method, computer readable storage medium and computer device

Publications (1)

Publication Number Publication Date
CN114710430A true CN114710430A (en) 2022-07-05

Family

ID=82171820

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210356584.0A Pending CN114710430A (en) 2022-04-06 2022-04-06 Bidirectional communication control method, computer readable storage medium and computer device

Country Status (1)

Country Link
CN (1) CN114710430A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110177127A (en) * 2019-04-15 2019-08-27 阿里巴巴集团控股有限公司 Data transmission method, device and equipment based on grpc frame
CN110321237A (en) * 2019-07-12 2019-10-11 四川长虹电子系统有限公司 The method for realizing comprehensive improvement working end system communication based on grpc and protobuf
CN111464373A (en) * 2019-01-18 2020-07-28 苏宁易购集团股份有限公司 Micro-service full-link monitoring system and method
CN112910733A (en) * 2021-01-29 2021-06-04 上海华兴数字科技有限公司 Full link monitoring system and method based on big data

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111464373A (en) * 2019-01-18 2020-07-28 苏宁易购集团股份有限公司 Micro-service full-link monitoring system and method
CN110177127A (en) * 2019-04-15 2019-08-27 阿里巴巴集团控股有限公司 Data transmission method, device and equipment based on grpc frame
CN110321237A (en) * 2019-07-12 2019-10-11 四川长虹电子系统有限公司 The method for realizing comprehensive improvement working end system communication based on grpc and protobuf
CN112910733A (en) * 2021-01-29 2021-06-04 上海华兴数字科技有限公司 Full link monitoring system and method based on big data

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
IT技术: "grpc 中的 stream(服务中的长连接,订阅,上传大数据等)", pages 1, Retrieved from the Internet <URL:https://www.codercto.com/a/109362.html> *
周志明: "《 凤凰架构:构建可靠的大型分布式系统》", 30 June 2021, 机械工业出版社, pages: 241 *
朱荣鑫,黄迪璇,张天: "《go语言高并发与微服务实战》", 30 April 2020, 中国铁道出版社, pages: 189 *

Similar Documents

Publication Publication Date Title
JP6370912B2 (en) Method and terminal device for transmitting and receiving user data
CN109359091B (en) File management method, device, terminal and computer readable storage medium
CN107786623B (en) Message asynchronous processing method and device
CN102724122B (en) Reliable serial port transmission method and device based on hardware system
CN106686021B (en) Service calling method and gateway
CN108989432A (en) Document sending method, document receiving method and the transmitting/receiving file device of User space
CN104243610A (en) Distributed file transmission service method
CN104125135A (en) Instant messaging application chatting record management method and terminal thereof
CN112616024A (en) USB camera data acquisition method and device, electronic equipment and storage medium
CN101699421B (en) Method and server for sharing serial port
CN110457251B (en) Data communication method and device among multiple processors
JP5984552B2 (en) Load balancing system, load balancing system control method, and computer program
CN111757282B (en) Short message sending method and device
CN114710430A (en) Bidirectional communication control method, computer readable storage medium and computer device
CN112328272B (en) Algorithm upgrading method, device, equipment and storage medium
CN111770054A (en) Interaction acceleration method and system for SMB protocol read request
CN107229424B (en) Data writing method for distributed storage system and distributed storage system
CN108287793B (en) Response message buffering method and server
US20140310458A1 (en) Data transferring method and apparatus and storage system
CN113253956B (en) Print file processing method and device
CN113472744B (en) Data interaction method, device, equipment and medium under different storage protocols
CN110290435B (en) Optical fiber network management method and device and terminal equipment
CN114461425A (en) Data processing method, device, equipment and computer readable storage medium
CN114374657A (en) Data processing method and device
CN110288309B (en) Data interaction method, device, system, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination