[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN118193254B - A process communication method, device, medium and equipment - Google Patents

A process communication method, device, medium and equipment Download PDF

Info

Publication number
CN118193254B
CN118193254B CN202410606140.7A CN202410606140A CN118193254B CN 118193254 B CN118193254 B CN 118193254B CN 202410606140 A CN202410606140 A CN 202410606140A CN 118193254 B CN118193254 B CN 118193254B
Authority
CN
China
Prior art keywords
communication
message
communication mode
indirect
sending
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.)
Active
Application number
CN202410606140.7A
Other languages
Chinese (zh)
Other versions
CN118193254A (en
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.)
Shining 3D Technology Co Ltd
Original Assignee
Shining 3D 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 Shining 3D Technology Co Ltd filed Critical Shining 3D Technology Co Ltd
Priority to CN202410606140.7A priority Critical patent/CN118193254B/en
Publication of CN118193254A publication Critical patent/CN118193254A/en
Application granted granted Critical
Publication of CN118193254B publication Critical patent/CN118193254B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/542Event management; Broadcasting; Multicasting; Notifications
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/547Messaging middleware
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application provides a process communication method, a device, a medium and equipment, wherein the method comprises the following steps: acquiring a message sent by a sender process, wherein the message comprises a keyword for identifying a communication function; the process communication module locally stores the mapping relation between the keywords and the communication modes, wherein the communication modes comprise a direct communication mode of directly communicating a sender process with a receiver process and an indirect communication mode of communicating the sender process with the receiver process through a transfer unit; analyzing the keywords in the message, and determining a corresponding communication mode according to the mapping relation; and sending the message to the receiver process based on the determined communication mode. According to the application, different communication strategies can be flexibly adopted according to specific communication scene requirements, the problem of low speed of a single transit communication mode is effectively solved, and the communication efficiency between processes is obviously improved, so that the method can be better suitable for equipment with high requirements on data transmission rate, such as scanners.

Description

一种进程通信方法、装置、介质及设备A process communication method, device, medium and equipment

技术领域Technical Field

本说明书涉及网络通信技术领域,尤其涉及一种进程通信方法、装置、介质及设备。The present invention relates to the field of network communication technology, and in particular to a process communication method, device, medium and equipment.

背景技术Background Art

在现代信息技术领域,进程间通信是实现多任务操作系统中不同进程之间数据交换和同步的关键技术,而进程间通信的效率直接影响到设备的整体性能和响应速度。In the field of modern information technology, inter-process communication is a key technology for realizing data exchange and synchronization between different processes in a multi-tasking operating system, and the efficiency of inter-process communication directly affects the overall performance and response speed of the device.

目前,现有的进程间通信技术大多基于QtTunnel模块,通过QTcpSocket发送给Broker实现进程间通信。然而,这种方法在传输大量数据时,往往会遇到传输速度慢的问题,而这对于扫描仪等需要处理大量数据和高速数据传输的应用场景来说是不可接受的。Currently, most of the existing inter-process communication technologies are based on the QtTunnel module, which is sent to the Broker through QTcpSocket to achieve inter-process communication. However, this method often encounters the problem of slow transmission speed when transmitting large amounts of data, which is unacceptable for application scenarios such as scanners that require processing large amounts of data and high-speed data transmission.

发明内容Summary of the invention

为克服相关技术中存在的问题,本说明书提供了一种进程通信方法、装置、介质及设备。To overcome the problems existing in the related art, this specification provides a process communication method, device, medium and equipment.

根据本说明书实施例的第一方面,提供一种进程通信方法,应用于进程通信模块,所述方法包括:According to a first aspect of an embodiment of this specification, a process communication method is provided, which is applied to a process communication module, and the method includes:

获取发送方进程发送的消息,所述消息中包括标识通信功能的关键字;所述进程通信模块本地存储有关键字与通信方式的映射关系,所述通信方式包括发送方进程与接收方进程直接通信的直接通信方式,以及发送方进程与接收方进程通过中转单元进行通信的间接通信方式;Acquire a message sent by a sending process, wherein the message includes a keyword identifying a communication function; the process communication module locally stores a mapping relationship between the keyword and the communication mode, wherein the communication mode includes a direct communication mode in which the sending process directly communicates with the receiving process, and an indirect communication mode in which the sending process communicates with the receiving process through a transfer unit;

解析所述消息中的关键字,并根据所述映射关系确定对应的通信方式;Parsing the keywords in the message and determining the corresponding communication mode according to the mapping relationship;

基于确定的通信方式,将所述消息发送至所述接收方进程。Based on the determined communication mode, the message is sent to the recipient process.

根据本说明书实施例的第二方面,提供一种进程通信装置,应用于进程通信模块,所述装置包括:According to a second aspect of an embodiment of this specification, a process communication device is provided, which is applied to a process communication module, and the device includes:

消息获取模块,用于获取发送方进程发送的消息,所述消息中包括标识通信功能的关键字;所述进程通信模块本地存储有关键字与通信方式的映射关系,所述通信方式包括发送方进程与接收方进程直接通信的直接通信方式,以及发送方进程与接收方进程通过中转单元进行通信的间接通信方式;A message acquisition module, used to acquire a message sent by a sending process, wherein the message includes a keyword identifying a communication function; the process communication module locally stores a mapping relationship between the keyword and the communication mode, wherein the communication mode includes a direct communication mode in which the sending process directly communicates with the receiving process, and an indirect communication mode in which the sending process communicates with the receiving process via a transfer unit;

通信方式确定模块,用于解析所述消息中的关键字,并根据所述映射关系确定对应的通信方式;A communication mode determination module, used to parse the keywords in the message and determine the corresponding communication mode according to the mapping relationship;

消息发送模块,用于基于确定的通信方式,将所述消息发送至所述接收方进程。The message sending module is used to send the message to the receiving process based on the determined communication mode.

根据本说明书实施例的第三方面,提供一种计算机可读存储介质,存储有计算机程序,所述程序被处理器执行时实现上述任一项所述通信方法的步骤。According to a third aspect of the embodiments of this specification, a computer-readable storage medium is provided, storing a computer program, wherein the program, when executed by a processor, implements the steps of any one of the above-mentioned communication methods.

根据本说明书实施例的第四方面,提供一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现上述任一项所述通信方法的步骤。According to a fourth aspect of the embodiments of this specification, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any one of the above-mentioned communication methods when executing the program.

本说明书的实施例提供的技术方案可以包括以下有益效果:The technical solutions provided by the embodiments of this specification may have the following beneficial effects:

本说明书实施例中,通过动态分析进程通信传输的消息,为不同通信场景选择最合适的通信方式,以实现根据具体的通信场景需求,灵活地采用不同的通信策略,有效解决了单一中转通信方式速度慢的问题,显著提升了进程间通信的效率,使其能够更好地适用于扫描仪等对数据传输速率有高要求的设备。In the embodiments of this specification, by dynamically analyzing the messages transmitted by process communication, the most appropriate communication method is selected for different communication scenarios, so that different communication strategies can be flexibly adopted according to the specific communication scenario requirements, effectively solving the problem of slow speed of a single transit communication method, and significantly improving the efficiency of inter-process communication, making it better suitable for devices such as scanners that have high requirements for data transmission rates.

应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本说明书。It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present specification.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本说明书的实施例,并与说明书一起用于解释本说明书的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the specification and, together with the description, serve to explain the principles of the specification.

图1是本说明书根据一示例性实施例示出的一种进程通信方法的流程图。FIG. 1 is a flow chart of a process communication method according to an exemplary embodiment of the present specification.

图2是本说明书根据一示例性实施例示出的一种间接通信方式中通信连接关系示意图。FIG. 2 is a schematic diagram of a communication connection relationship in an indirect communication method according to an exemplary embodiment of this specification.

图3是本说明书根据一示例性实施例示出的一种通信方式为间接通信方式时的进程通信方法的流程图。FIG3 is a flowchart of a process communication method when a communication mode is an indirect communication mode according to an exemplary embodiment of the present specification.

图4是本说明书根据一示例性实施例示出的另一种通信方式为间接通信方式时的进程通信方法的流程图。FIG. 4 is a flowchart of a process communication method when another communication mode is an indirect communication mode according to an exemplary embodiment of the present specification.

图5是本说明书根据一示例性实施例示出的一种直接通信方式中通信连接关系示意图。FIG5 is a schematic diagram of a communication connection relationship in a direct communication mode according to an exemplary embodiment of this specification.

图6是本说明书根据一示例性实施例示出的一种通信方式为直接通信方式时的进程通信方法的流程图。FIG6 is a flowchart of a process communication method when a communication mode is a direct communication mode according to an exemplary embodiment of the present specification.

图7是本说明书根据一示例性实施例示出的一种通信方式为直接通信方式时的进程通信方法的流程图。FIG. 7 is a flowchart of a process communication method when a communication mode is a direct communication mode according to an exemplary embodiment of the present specification.

图8是本说明书实施例进程通信装置所在计算机设备的一种硬件结构图。FIG8 is a hardware structure diagram of a computer device where the process communication device of the embodiment of this specification is located.

图9是本说明书根据一示例性实施例示出的一种进程通信装置的框图。FIG. 9 is a block diagram of a process communication device according to an exemplary embodiment of the present specification.

具体实施方式DETAILED DESCRIPTION

这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本说明书相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本说明书的一些方面相一致的装置和方法的例子。Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with this specification. Instead, they are merely examples of devices and methods consistent with some aspects of this specification as detailed in the appended claims.

在本说明书使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本说明书。在本说明书和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。The terms used in this specification are for the purpose of describing specific embodiments only and are not intended to limit this specification. The singular forms "a", "the" and "the" used in this specification and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and/or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

应当理解,尽管在本说明书可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本说明书范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。It should be understood that although the terms first, second, third, etc. may be used in this specification to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of this specification, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

现有的进程间通信,普遍采用基于QTcpSocket的中转通信方式。具体来说,进程通信依赖于QtTunnel模块,通过QTcpSocket将消息发送给Broker,再由Broker完成消息的中转。The existing inter-process communication generally adopts the QTcpSocket-based relay communication method. Specifically, the inter-process communication relies on the QtTunnel module, which sends messages to the Broker through QTcpSocket, and then the Broker completes the message relay.

在这种中转通信方式中,所有通信数据都必须经过中转服务器(如MQTT Broker)进行转发,这一过程不仅引入了额外的网络延迟,还可能在处理大量数据传输时,因为服务器的负载和网络条件进一步限制数据传输速率,导致传输速度显著下降,例如,即使传输空的map数据也需要约10毫秒左右的时间。In this relay communication mode, all communication data must be forwarded through a relay server (such as MQTT Broker). This process not only introduces additional network delays, but also may significantly reduce the transmission speed when processing large amounts of data transmission because the server load and network conditions further limit the data transmission rate. For example, even transmitting empty map data takes about 10 milliseconds.

而对于需要处理大量数据和高速数据传输的应用场景,如扫描仪来说,它在扫描过程中,需要快速连续地处理和传输大量数据,以保证扫描图像质量和处理速度,现有的进程通信方式数据传输速率明显无法完全匹配扫描仪的使用需求,将严重影响扫描仪等设备的工作效率和用户体验。For application scenarios that require processing large amounts of data and high-speed data transmission, such as scanners, a large amount of data needs to be processed and transmitted quickly and continuously during the scanning process to ensure the scanned image quality and processing speed. The data transmission rate of the existing process communication method obviously cannot fully match the use requirements of the scanner, which will seriously affect the work efficiency and user experience of scanners and other equipment.

针对上述现有技术的局限,本申请提出一种新的进程通信方法,通过动态分析进程通信传输的消息,为不同通信场景选择最合适的通信方式,以实现根据具体的通信场景需求,灵活地采用不同的通信策略,有效解决了单一中转通信方式速度慢的问题,显著提升了进程间通信的效率,使其能够更好地适用于扫描仪等对数据传输速率有高要求的设备。In view of the limitations of the above-mentioned prior art, the present application proposes a new process communication method, which dynamically analyzes the messages transmitted by process communication and selects the most appropriate communication method for different communication scenarios, so as to flexibly adopt different communication strategies according to the specific communication scenario requirements, effectively solves the problem of slow speed of single transit communication method, and significantly improves the efficiency of inter-process communication, making it better suitable for devices with high requirements for data transmission rate, such as scanners.

接下来对本说明书实施例进行详细说明。Next, the embodiments of this specification are described in detail.

图1是本说明书根据一示例性实施例示出的一种进程通信方法的流程图。如图1所示,该进程通信方法,应用于进程通信模块,包括以下步骤:FIG1 is a flow chart of a process communication method according to an exemplary embodiment of the present specification. As shown in FIG1 , the process communication method is applied to a process communication module and includes the following steps:

S101、获取发送方进程发送的消息,消息中包括标识通信功能的关键字;进程通信模块本地存储有关键字与通信方式的映射关系,通信方式包括发送方进程与接收方进程直接通信的直接通信方式,以及发送方进程与接收方进程通过中转单元进行通信的间接通信方式;S101, obtaining a message sent by a sending process, the message including a keyword identifying a communication function; a process communication module locally stores a mapping relationship between the keyword and a communication mode, the communication mode including a direct communication mode in which the sending process directly communicates with the receiving process, and an indirect communication mode in which the sending process communicates with the receiving process through a transfer unit;

S102、解析消息中的关键字,并根据映射关系确定对应的通信方式;S102, parsing the keywords in the message, and determining the corresponding communication mode according to the mapping relationship;

S103、基于确定的通信方式,将消息发送至所述接收方进程。S103: Send the message to the receiving process based on the determined communication method.

进程通信模块可以是各类框架下基于各类通信协议开发的实现进程间数据传输和通信的软件组件。以下实施例以进程通信模块为Qt框架中基于MQTT协议开发的QtTunnel模块举例进行说明。The process communication module can be a software component developed under various frameworks based on various communication protocols to realize inter-process data transmission and communication. The following embodiments are described by taking the process communication module as the QtTunnel module developed based on the MQTT protocol in the Qt framework as an example.

在进行进程通信时,发送方进程可以调用QtTunnel模块的通信接口,传入待发送的消息。由于发送方进程可能存在不同的通信需求,则该消息中可能不仅包括需要传输的具体数据内容,还包括标识各类通信功能的关键字,通信功能可以理解为表征发送方进程进行通信的需求和目的,进而使得QtTunnel模块可以动态识别消息中关键字,对不同通信功能的进程通信进行区分,合理依据不同进程通信的特性灵活选择合适的通信方式,从而避免所有通信过程均采用单一的中转方式,出现通信效率慢的问题。When performing process communication, the sending process can call the communication interface of the QtTunnel module and pass in the message to be sent. Since the sending process may have different communication requirements, the message may include not only the specific data content to be transmitted, but also keywords that identify various communication functions. The communication function can be understood as the need and purpose of the sending process to communicate, so that the QtTunnel module can dynamically identify the keywords in the message, distinguish the process communications with different communication functions, and flexibly select the appropriate communication method based on the characteristics of different process communications, thereby avoiding the problem of slow communication efficiency caused by the use of a single transit method in all communication processes.

确定通信方式的具体操作可以是,在QtTunnel模块本地预先存储关键字和适合的通信方式的映射关系,当QtTunnel模块识别出某个关键字时,通过查找映射关系确定相对应的通信方式。本地存储映射关系的形式可以是关联数组、映射表等多种形式。The specific operation of determining the communication mode may be to pre-store the mapping relationship between the keyword and the appropriate communication mode in the QtTunnel module locally, and when the QtTunnel module identifies a keyword, determine the corresponding communication mode by searching the mapping relationship. The local storage mapping relationship may be in various forms such as an associative array and a mapping table.

本实施例中,提供间接通信方式和直接通信方式的两种通信方式,间接通信方式涉及通过中转单元进行消息转发;而直接通信方式则允许发送方和接收方进程进行点对点的直接通信,无需中转单元介入,进而可以显著减少通信延,提升通信效率。具体地,间接通信方式可以包括QTcpSocket或QLocalSocket,直接通信方式可以包括boost::message_queue。In this embodiment, two communication modes, indirect communication mode and direct communication mode, are provided. The indirect communication mode involves message forwarding through a transfer unit; while the direct communication mode allows the sender and the receiver process to communicate directly point-to-point without the intervention of the transfer unit, thereby significantly reducing communication delay and improving communication efficiency. Specifically, the indirect communication mode may include QTcpSocket or QLocalSocket, and the direct communication mode may include boost::message_queue.

进程间的通信功能大致可以分为两大类。第一类通信功能主要涉及复杂的交互性和多方通信操作,例如发起请求、提供应答、广播消息、订阅消息、建立映射关系、执行回调操作等,对应的关键字可以分别为req、map、pub、sub、rep、cab。这类通信功能通常需要跨进程或跨网络节点进行,可能包含复杂的路由步骤。因此,它们需要设置相应的中介服务进行协调和管理。例如,在请求/响应模式中,中心节点负责协调请求的发送和响应的接收;消息广播则由中介节点负责将消息分发给多个订阅者;建立映射关系和执行回调操作时,中介服务则负责维护和跟踪状态信息。这些需求与间接通信方式的特性相契合,可以利用其中的中转单元有效地实现这些复杂的通信需求。第二类通信功能主要涉及同设备内的简单进程通信,如消息队列发送和接收等,对应的关键字可以分别为mqs、mqr。这类通信功能不涉及复杂的路由,并不需要设置额外的中介服务进行管理,因此直接通信方式更为适宜,可以减少不必要的中转开销,提高数据传输的效率。The communication functions between processes can be roughly divided into two categories. The first type of communication functions mainly involve complex interactivity and multi-party communication operations, such as initiating requests, providing responses, broadcasting messages, subscribing to messages, establishing mapping relationships, executing callback operations, etc. The corresponding keywords can be req, map, pub, sub, rep, cab. Such communication functions usually need to be performed across processes or network nodes, and may include complex routing steps. Therefore, they need to set up corresponding intermediary services for coordination and management. For example, in the request/response mode, the central node is responsible for coordinating the sending of requests and the receiving of responses; the intermediary node is responsible for distributing messages to multiple subscribers when broadcasting messages; when establishing mapping relationships and executing callback operations, the intermediary service is responsible for maintaining and tracking status information. These requirements are consistent with the characteristics of indirect communication methods, and the transit unit can be used to effectively implement these complex communication requirements. The second type of communication functions mainly involve simple process communications within the same device, such as message queue sending and receiving, etc. The corresponding keywords can be mqs and mqr. This type of communication function does not involve complex routing and does not require the establishment of additional intermediary services for management. Therefore, direct communication is more appropriate, which can reduce unnecessary transit costs and improve the efficiency of data transmission.

基于上述特征,在一些实施例中,解析消息中的关键字,并根据映射关系确定对应的通信方式,可以包括:若识别出标识第一通信功能的关键字,确定通信方式为间接通信方式,第一通信功能包括发起请求、和/或提供应答、和/或广播消息、和/或订阅消息、和/或建立映射关系、和/或执行回调操作;若识别出标识第二通信功能的关键字,确定通信方式为直接通信方式,第二通信功能包括消息队列发送、和/或消息队列接收。Based on the above features, in some embodiments, parsing keywords in the message and determining the corresponding communication method based on the mapping relationship may include: if a keyword identifying the first communication function is identified, determining that the communication method is an indirect communication method, and the first communication function includes initiating a request, and/or providing a response, and/or broadcasting a message, and/or subscribing to a message, and/or establishing a mapping relationship, and/or performing a callback operation; if a keyword identifying the second communication function is identified, determining that the communication method is a direct communication method, and the second communication function includes message queue sending, and/or message queue receiving.

其中,在QtTunnel模块内部可以通过Qt元信息解析机制来解析消息中的关键字。Qt元信息是Qt框架提供的一种运行时消息对象检查和操作功能,它允许程序获取消息对象的类信息、方法、属性等。The QtTunnel module can parse the keywords in the message through the Qt meta information parsing mechanism. Qt meta information is a runtime message object inspection and operation function provided by the Qt framework, which allows the program to obtain the class information, methods, properties, etc. of the message object.

不同的通信方式中,进程之间的通信连接关系以及通信过程不同,下面分别针对通信方式为间接通信方式和直接通信方式的进程通信方法进行说明。In different communication modes, the communication connection relationship and the communication process between processes are different. The following describes the process communication methods for indirect communication mode and direct communication mode respectively.

若确定的通信方式为间接通信方式,发送方进程和接收方进程可以通过进程通信模块与中转单元建立通信连接,通信连接关系示意图如图2所示。进程通信模块获取发送方进程发送的消息后,先将该消息发送至中转单元,再通过中转单元将该消息转发至接收方进程。由于间接通信方式中设置有中转单元进行消息中转处理,可以进行各种复杂的通信需求,因此既可以用于跨设备的进程通信,也可以用于同设备的进程通信。If the determined communication mode is an indirect communication mode, the sender process and the receiver process can establish a communication connection with the transfer unit through the process communication module. The schematic diagram of the communication connection relationship is shown in Figure 2. After the process communication module obtains the message sent by the sender process, it first sends the message to the transfer unit, and then forwards the message to the receiver process through the transfer unit. Since the indirect communication mode is provided with a transfer unit for message transfer processing, various complex communication requirements can be met, so it can be used for both cross-device process communication and process communication on the same device.

图3是本说明书根据一示例性实施例示出的一种通信方式为间接通信方式时的进程通信方法的流程图。如图3所示,该进程通信方法前两个步骤与图1中实施例方法的前两个步骤相同,将步骤S103进一步细化为步骤S203:若确定的通信方式为间接通信方式,将消息发送至中转单元,以使中转单元将消息转发至接收方进程。Fig. 3 is a flowchart of a process communication method when a communication mode is an indirect communication mode according to an exemplary embodiment of the present specification. As shown in Fig. 3, the first two steps of the process communication method are the same as the first two steps of the method in the embodiment of Fig. 1, and step S103 is further refined into step S203: if the determined communication mode is an indirect communication mode, the message is sent to the transfer unit so that the transfer unit forwards the message to the receiving process.

为了更加精准地适应不同间接通信需求,在一些实施例中,可以将间接通信方式细分为包括第一间接通信方式以及第二间接通信方式;第一间接通信方式用于实现跨设备的进程通信或同设备的进程通信,第二间接通信方式用于实现同设备的进程通信;第二间接通信方式实现同设备的进程通信时的通信性能,高于第一间接通信方式实现同设备的进程通信时的通信性能。例如,具体地,第一间接通信方式可以是QTcpSocket,第二间接通信方式可以是QLocalSocket。In order to more accurately adapt to different indirect communication needs, in some embodiments, the indirect communication method can be subdivided into a first indirect communication method and a second indirect communication method; the first indirect communication method is used to implement cross-device process communication or same-device process communication, and the second indirect communication method is used to implement the same-device process communication; the communication performance of the second indirect communication method when implementing the same-device process communication is higher than the communication performance of the first indirect communication method when implementing the same-device process communication. For example, specifically, the first indirect communication method can be QTcpSocket, and the second indirect communication method can be QLocalSocket.

基于这两种间接通信方式,进程通信模块可以通过不同的构造函数进行初始化,根据解析出的构造函数中参数的不同,在发送方进程、接收方进程和中转单元之间建立对应不同间接通信方式的通信连接,使得在后续的进程通信过程中,一旦确定通信方式为间接通信方式,进程通信模块将只能通过已建立连接的、与实际通信需求相匹配的间接通信方式进行通信,从而确保通信方式的选择能够精准贴合实际通信需求,从而优化通信效率和性能。其中,构造函数可以人工构造或自动生成,以匹配实际的间接通信需求。Based on these two indirect communication methods, the process communication module can be initialized through different constructors, and according to the different parameters in the parsed constructors, communication connections corresponding to different indirect communication methods are established between the sender process, the receiver process and the transfer unit, so that in the subsequent process communication process, once the communication method is determined to be an indirect communication method, the process communication module can only communicate through the established indirect communication method that matches the actual communication needs, thereby ensuring that the choice of communication method can accurately fit the actual communication needs, thereby optimizing communication efficiency and performance. Among them, the constructor can be manually constructed or automatically generated to match the actual indirect communication needs.

具体地,若构造函数中的参数包括端口号,表明该通信需求可能涉及跨设备上的进程通信,因为端口号通常与IP地址结合使用,用于确保数据跨越网络到达目标设备和进程,又由于第一间接通信方式适用于跨设备的进程通信,因此,则可以确定当前间接通信方式为第一间接通信方式,并在发送方进程、接收方进程和中转单元之间建立对应第一间接通信方式的通信连接;而若构造函数中的参数包括服务名,通常表明该通信需求可能仅限于同一设备中的特定进程或服务,又由于第二间接通信方式适用于同设备进程通信,且能够提供比第一间接通信方式更高的通信性能,因此,则可以确定当前间接通信方式为第二间接通信方式,并在发送方进程、接收方进程和中转单元之间建立对应第二间接通信方式的通信连接。Specifically, if the parameters in the constructor include a port number, it indicates that the communication requirement may involve process communication across devices, because the port number is usually used in conjunction with the IP address to ensure that data reaches the target device and process across the network, and since the first indirect communication method is applicable to process communication across devices, it can be determined that the current indirect communication method is the first indirect communication method, and a communication connection corresponding to the first indirect communication method is established between the sender process, the receiver process, and the transit unit; and if the parameters in the constructor include a service name, it usually indicates that the communication requirement may be limited to a specific process or service in the same device, and since the second indirect communication method is applicable to process communication with the same device and can provide higher communication performance than the first indirect communication method, it can be determined that the current indirect communication method is the second indirect communication method, and a communication connection corresponding to the second indirect communication method is established between the sender process, the receiver process, and the transit unit.

图4是本说明书根据一示例性实施例示出的另一种通信方式为间接通信方式时的进程通信方法的流程图。如图4所示,该进程通信方法其余步骤不变,仅对图3中步骤S303进行细化,使其细化为:FIG4 is a flowchart of a process communication method when another communication mode is an indirect communication mode according to an exemplary embodiment of the present specification. As shown in FIG4, the remaining steps of the process communication method remain unchanged, and only step S303 in FIG3 is refined to be:

S403、若确定的通信方式为间接通信方式,获取并解析初始化进程通信模块的构造函数;S403: If the determined communication mode is an indirect communication mode, obtain and parse a constructor of an initialization process communication module;

S404、若构造参数包括端口号,则确定间接通信方式为第一间接通信方式,并在发送方进程、接收方进程和中转单元之间建立对应第一间接通信方式的通信连接;S404: If the construction parameter includes a port number, determine that the indirect communication mode is a first indirect communication mode, and establish a communication connection corresponding to the first indirect communication mode between the sender process, the receiver process, and the transfer unit;

S405、若构造参数包括服务名,则确定间接通信方式为第二间接通信方式,并在发送方进程、接收方进程和中转单元之间建立对应第二间接通信方式的通信连接;S405: If the construction parameter includes a service name, determining that the indirect communication mode is a second indirect communication mode, and establishing a communication connection corresponding to the second indirect communication mode between the sender process, the receiver process, and the transfer unit;

S406、将消息发送至中转单元,以使中转单元将所述消息转发至接收方进程。S406: Send the message to the transfer unit so that the transfer unit forwards the message to the receiving process.

若确定的通信方式为直接通信方式,发送方进程和接收方进程可以直接进行点对点通信,通信连接关系示意图如图5所示。进程通信模块获取发送方进程发送的消息后,将消息写入发送方进程与接收方进程共享的消息队列,以使接收方进程从消息队列中获取消息。If the determined communication mode is direct communication mode, the sender process and the receiver process can directly communicate point-to-point, and the communication connection relationship diagram is shown in Figure 5. After the process communication module obtains the message sent by the sender process, it writes the message into the message queue shared by the sender process and the receiver process, so that the receiver process obtains the message from the message queue.

图6是本说明书根据一示例性实施例示出的一种通信方式为直接通信方式时的进程通信方法的流程图。如图6所示,该进程通信方法前两个步骤与图1中实施例方法的前两个步骤相同,将步骤S103进一步细化为步骤S603:若确定的通信方式为直接通信方式,将消息写入发送方进程与接收方进程共享的消息队列,以使接收方进程从消息队列中获取消息。Fig. 6 is a flowchart of a process communication method when a communication mode is a direct communication mode according to an exemplary embodiment of the present specification. As shown in Fig. 6, the first two steps of the process communication method are the same as the first two steps of the method in the embodiment of Fig. 1, and step S103 is further refined into step S603: if the communication mode determined is a direct communication mode, write the message into a message queue shared by the sending process and the receiving process, so that the receiving process obtains the message from the message queue.

进一步地,为了使得接收方进程能够准确从消息队列中获取发给本进程的消息,在一些实施例中,消息中还可以包括接收方进程的标识信息;以使接收方进程根据标识信息从消息队列中获取发送给本进程的消息。Furthermore, in order to enable the receiving process to accurately obtain the message sent to the present process from the message queue, in some embodiments, the message may also include identification information of the receiving process; so that the receiving process can obtain the message sent to the present process from the message queue according to the identification information.

图7是本说明书根据一示例性实施例示出的另一种通信方式为直接通信方式时的进程通信方法的流程图。如图7所示,该进程通信方法前两个步骤与图6中实施例方法的前两个步骤相同,将步骤S603进一步细化为步骤S703:若确定的通信方式为直接通信方式,将消息写入发送方进程与接收方进程共享的消息队列,以使接收方进程根据标识信息从消息队列中获取发送给本进程的消息。FIG7 is a flowchart of a process communication method when another communication mode is a direct communication mode according to an exemplary embodiment of the present specification. As shown in FIG7, the first two steps of the process communication method are the same as the first two steps of the embodiment method in FIG6, and step S603 is further refined into step S703: if the determined communication mode is a direct communication mode, write the message into a message queue shared by the sending process and the receiving process, so that the receiving process obtains the message sent to the present process from the message queue according to the identification information.

此外,本说明书还提供了对上述实施例提及的QTcpSocket、QLocalSocket、boost::message_queue三种通信方式在进程通信中的数据传输速度进行的测试验证,以评估和比较这三种通信方式在实际应用中的性能,特别是在数据传输速度方面的表现。In addition, this specification also provides a test verification of the data transmission speed of the three communication methods QTcpSocket, QLocalSocket, and boost::message_queue mentioned in the above embodiments in process communication, so as to evaluate and compare the performance of these three communication methods in actual applications, especially in terms of data transmission speed.

测试过程:Testing process:

1、业务发送进程随机生成固定长度的QByteArray数组,并通过指定的底层通信方式发送数据到业务接收端。1. The business sending process randomly generates a QByteArray array of fixed length and sends the data to the business receiving end through the specified underlying communication method.

2、业务接收进程接收到数据后,发送接收成功的消息到业务发送进程。2. After receiving the data, the business receiving process sends a successful reception message to the business sending process.

3、业务发送进程收到业务接收进程的成功消息后,完成一轮消息发送。3. After the business sending process receives the success message from the business receiving process, a round of message sending is completed.

4、重复上述操作1000次,并统计这1000轮消息发送的平均耗时。4. Repeat the above operation 1000 times and calculate the average time taken to send these 1000 rounds of messages.

5、在测试程序中,将会记录每一轮消息发送的开始时间和结束时间,以便计算每轮消息发送的耗时,并最终得出平均耗时。5. In the test program, the start time and end time of each round of message sending will be recorded in order to calculate the time taken for each round of message sending and finally get the average time taken.

QTcpSocket速度传输验证QTcpSocket speed transmission verification

QLocalSocket速度传输验证QLocalSocket speed transmission verification

Boost::MessageQueue速度传输验证Boost::MessageQueue speed transmission verification

测试结果表明,QLocalSocket和boost::message_queue通信性能均优于QTcpSocket,对于同设备内的进程通信,可以显著提升通信效率,验证了本申请在提高进程间通信效率方面的有效性,特别是在对实时性要求高的应用程序或设备中。The test results show that the communication performance of QLocalSocket and boost::message_queue is better than that of QTcpSocket. For process communication within the same device, the communication efficiency can be significantly improved, which verifies the effectiveness of this application in improving the efficiency of inter-process communication, especially in applications or devices with high real-time requirements.

与前述方法的实施例相对应,本说明书还提供了进程通信装置及其所应用的终端的实施例。Corresponding to the embodiments of the aforementioned method, this specification also provides embodiments of a process communication device and a terminal used therein.

本说明书进程通信装置的实施例可以应用在计算机设备上,例如服务器或终端设备。该装置实施例可以通过软件实现,也可以通过硬件或者软硬件结合的方式实现。以软件实现为例,作为一个逻辑意义上的装置,是通过处理器将非易失性存储器中对应的计算机程序指令读取到内存中运行形成的。从硬件层面而言,如图8所示,为本说明书实施例进程通信装置所在计算机设备的一种硬件结构图,除了图8所示的处理器801、内存802、网络接口803、以及非易失性存储器804之外,实施例中装置所在的服务器或电子设备,通常根据该计算机设备的实际功能,还可以包括其他硬件,对此不再赘述。The embodiments of the process communication device of this specification can be applied to computer equipment, such as servers or terminal devices. The device embodiment can be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by the processor reading the corresponding computer program instructions in the non-volatile memory into the memory and running them. From the hardware level, as shown in Figure 8, it is a hardware structure diagram of the computer device where the process communication device of the embodiment of this specification is located. In addition to the processor 801, memory 802, network interface 803, and non-volatile memory 804 shown in Figure 8, the server or electronic device where the device is located in the embodiment can also include other hardware according to the actual function of the computer device, which will not be described in detail.

图9是本说明书根据一示例性实施例示出的一种进程通信装置的框图。如图9所示,该进程通信装置包括:FIG9 is a block diagram of a process communication device according to an exemplary embodiment of the present specification. As shown in FIG9 , the process communication device includes:

消息获取模块901,用于获取发送方进程发送的消息,消息中包括标识通信功能的关键字;进程通信模块本地存储有关键字与通信方式的映射关系,通信方式包括发送方进程与接收方进程直接通信的直接通信方式,以及发送方进程与接收方进程通过中转单元进行通信的间接通信方式;The message acquisition module 901 is used to acquire the message sent by the sender process, wherein the message includes a keyword identifying a communication function; the process communication module locally stores a mapping relationship between the keyword and the communication mode, wherein the communication mode includes a direct communication mode in which the sender process communicates directly with the receiver process, and an indirect communication mode in which the sender process communicates with the receiver process through a transfer unit;

通信方式确定模块902,用于解析消息中的关键字,并根据映射关系确定对应的通信方式;The communication mode determination module 902 is used to parse the keywords in the message and determine the corresponding communication mode according to the mapping relationship;

消息发送模块903,用于基于确定的通信方式,将消息发送至接收方进程。The message sending module 903 is used to send the message to the receiving process based on the determined communication mode.

相应的,本说明书还提供一种计算机可读存储介质,存储有计算机程序,该程序被处理器执行时实现上述任一实施例所述通信方法的步骤。Accordingly, the present specification also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the communication method described in any of the above embodiments.

相应的,本说明书还提供一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,该处理器执行该程序时实现上述任一实施例所述通信方法的步骤。Accordingly, the present specification also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the communication method described in any of the above embodiments when executing the program.

上述装置中各个模块的功能和作用的实现过程具体详见上述方法中对应步骤的实现过程,在此不再赘述。The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, which will not be repeated here.

对于装置实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部模块来实现本说明书方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this specification. Ordinary technicians in this field can understand and implement it without paying creative work.

上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。The above is a description of a specific embodiment of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

本领域技术人员在考虑说明书及实践这里申请的发明后,将容易想到本说明书的其它实施方案。本说明书旨在涵盖本说明书的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本说明书的一般性原理并包括本说明书未申请的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本说明书的真正范围和精神由下面的权利要求指出。Those skilled in the art will readily appreciate other embodiments of the specification after considering the specification and practicing the invention claimed herein. The specification is intended to cover any variations, uses or adaptations of the specification that follow the general principles of the specification and include common knowledge or customary techniques in the art that are not claimed in the specification. The specification and examples are to be considered exemplary only, and the true scope and spirit of the specification are indicated by the following claims.

应当理解的是,本说明书并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本说明书的范围仅由所附的权利要求来限制。It should be understood that the present description is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present description is limited only by the appended claims.

以上所述仅为本说明书的较佳实施例而已,并不用以限制本说明书,凡在本说明书的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本说明书保护的范围之内。The above description is only a preferred embodiment of this specification and is not intended to limit this specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of this specification should be included in the scope of protection of this specification.

Claims (8)

1.一种进程通信方法,其特征在于,应用于进程通信模块,所述方法包括:1. A process communication method, characterized in that it is applied to a process communication module, the method comprising: 获取发送方进程发送的消息,所述消息中包括标识通信功能的关键字;所述进程通信模块本地存储有关键字与通信方式的映射关系,所述通信方式包括发送方进程与接收方进程直接通信的直接通信方式,以及发送方进程与接收方进程通过中转单元进行通信的间接通信方式;Acquire a message sent by a sending process, wherein the message includes a keyword identifying a communication function; the process communication module locally stores a mapping relationship between the keyword and the communication mode, wherein the communication mode includes a direct communication mode in which the sending process directly communicates with the receiving process, and an indirect communication mode in which the sending process communicates with the receiving process through a transfer unit; 解析所述消息中的关键字,并根据所述映射关系确定对应的通信方式;Parsing the keywords in the message and determining the corresponding communication mode according to the mapping relationship; 基于确定的通信方式,将所述消息发送至所述接收方进程,包括:Based on the determined communication mode, sending the message to the receiving process includes: 若确定的通信方式为间接通信方式,将所述消息发送至所述中转单元,以使所述中转单元将所述消息转发至所述接收方进程;If the determined communication mode is an indirect communication mode, sending the message to the transfer unit so that the transfer unit forwards the message to the receiving process; 若确定的通信方式为直接通信方式,将所述消息写入所述发送方进程与接收方进程共享的消息队列,以使所述接收方进程从所述消息队列中获取所述消息;If the determined communication mode is a direct communication mode, writing the message into a message queue shared by the sender process and the receiver process, so that the receiver process obtains the message from the message queue; 其中,所述间接通信方式包括第一间接通信方式以及第二间接通信方式;Wherein, the indirect communication mode includes a first indirect communication mode and a second indirect communication mode; 所述第一间接通信方式用于实现跨设备的进程通信或同设备的进程通信,所述第二间接通信方式用于实现同设备的进程通信;The first indirect communication mode is used to implement inter-device process communication or intra-device process communication, and the second indirect communication mode is used to implement intra-device process communication; 所述第二间接通信方式实现同设备的进程通信时的通信性能,高于所述第一间接通信方式实现同设备的进程通信时的通信性能。The communication performance of the second indirect communication method when implementing process communication with the device is higher than the communication performance of the first indirect communication method when implementing process communication with the device. 2.根据权利要求1所述的方法,其特征在于,所述发送方进程和接收方进程通过所述进程通信模块与所述中转单元通信连接。2. The method according to claim 1 is characterized in that the sender process and the receiver process are communicatively connected to the transfer unit through the process communication module. 3.根据权利要求1所述的方法,其特征在于,所述消息中还包括所述接收方进程的标识信息;3. The method according to claim 1, characterized in that the message also includes identification information of the receiving process; 将所述消息写入所述发送方进程与接收方进程共享的消息队列,以使所述接收方进程从所述消息队列中获取所述消息,包括:Writing the message into a message queue shared by the sender process and the receiver process so that the receiver process obtains the message from the message queue includes: 将所述消息写入所述发送方进程与接收方进程共享的消息队列,以使所述接收方进程根据所述标识信息从所述消息队列中获取发送给本进程的消息。The message is written into a message queue shared by the sending process and the receiving process, so that the receiving process obtains the message sent to the present process from the message queue according to the identification information. 4.根据权利要求1所述的方法,其特征在于,在将所述消息发送至所述中转单元之前,还包括:4. The method according to claim 1, characterized in that before sending the message to the transfer unit, it also includes: 获取并解析初始化所述进程通信模块的构造函数;Obtain and parse a constructor for initializing the process communication module; 若所述构造函数包括端口号,则确定间接通信方式为第一间接通信方式,并在所述发送方进程、接收方进程和所述中转单元之间建立对应所述第一间接通信方式的通信连接;If the constructor includes a port number, determining that the indirect communication mode is a first indirect communication mode, and establishing a communication connection corresponding to the first indirect communication mode between the sender process, the receiver process and the transfer unit; 若所述构造函数包括服务名,则确定间接通信方式为第二间接通信方式,并在所述发送方进程、接收方进程和所述中转单元之间建立对应所述第二间接通信方式的通信连接。If the constructor includes a service name, the indirect communication mode is determined to be a second indirect communication mode, and a communication connection corresponding to the second indirect communication mode is established between the sender process, the receiver process and the transfer unit. 5.根据权利要求1至4任一项所述的方法,其特征在于,所述解析所述消息中的关键字,并根据所述映射关系确定对应的通信方式,包括:5. The method according to any one of claims 1 to 4, characterized in that the parsing of the keywords in the message and determining the corresponding communication mode according to the mapping relationship comprises: 若识别出标识第一通信功能的关键字,确定所述通信方式为间接通信方式,所述第一通信功能包括发起请求、和/或提供应答、和/或广播消息、和/或订阅消息、和/或建立映射关系、和/或执行回调操作;If a keyword identifying a first communication function is identified, it is determined that the communication mode is an indirect communication mode, and the first communication function includes initiating a request, and/or providing a response, and/or broadcasting a message, and/or subscribing to a message, and/or establishing a mapping relationship, and/or performing a callback operation; 若识别出标识第二通信功能的关键字,确定所述通信方式为直接通信方式,所述第二通信功能包括消息队列发送、和/或消息队列接收。If a keyword identifying a second communication function is identified, it is determined that the communication mode is a direct communication mode, and the second communication function includes message queue sending and/or message queue receiving. 6.一种进程通信装置,其特征在于,应用于进程通信模块,所述装置包括:6. A process communication device, characterized in that it is applied to a process communication module, and the device comprises: 消息获取模块,用于获取发送方进程发送的消息,所述消息中包括标识通信功能的关键字;所述进程通信模块本地存储有关键字与通信方式的映射关系,所述通信方式包括发送方进程与接收方进程直接通信的直接通信方式,以及发送方进程与接收方进程通过中转单元进行通信的间接通信方式;A message acquisition module, used to acquire a message sent by a sending process, wherein the message includes a keyword identifying a communication function; the process communication module locally stores a mapping relationship between the keyword and the communication mode, wherein the communication mode includes a direct communication mode in which the sending process directly communicates with the receiving process, and an indirect communication mode in which the sending process communicates with the receiving process via a transfer unit; 通信方式确定模块,用于解析所述消息中的关键字,并根据所述映射关系确定对应的通信方式;A communication mode determination module, used to parse the keywords in the message and determine the corresponding communication mode according to the mapping relationship; 消息发送模块,用于基于确定的通信方式,将所述消息发送至所述接收方进程;若确定的通信方式为间接通信方式,将所述消息发送至所述中转单元,以使所述中转单元将所述消息转发至所述接收方进程;若确定的通信方式为直接通信方式,将所述消息写入所述发送方进程与接收方进程共享的消息队列,以使所述接收方进程从所述消息队列中获取所述消息;A message sending module, configured to send the message to the receiving process based on the determined communication mode; if the determined communication mode is an indirect communication mode, send the message to the transfer unit so that the transfer unit forwards the message to the receiving process; if the determined communication mode is a direct communication mode, write the message into a message queue shared by the sending process and the receiving process so that the receiving process obtains the message from the message queue; 其中,所述间接通信方式包括第一间接通信方式以及第二间接通信方式;Wherein, the indirect communication mode includes a first indirect communication mode and a second indirect communication mode; 所述第一间接通信方式用于实现跨设备的进程通信或同设备的进程通信,所述第二间接通信方式用于实现同设备的进程通信;The first indirect communication mode is used to implement inter-device process communication or intra-device process communication, and the second indirect communication mode is used to implement intra-device process communication; 所述第二间接通信方式实现同设备的进程通信时的通信性能,高于所述第一间接通信方式实现同设备的进程通信时的通信性能。The communication performance of the second indirect communication method when implementing process communication with the device is higher than the communication performance of the first indirect communication method when implementing process communication with the device. 7.一种计算机可读存储介质,存储有计算机程序,其特征在于,所述程序被处理器执行时实现权利要求1至5任一项所述通信方法的步骤。7. A computer-readable storage medium storing a computer program, characterized in that when the program is executed by a processor, the steps of the communication method according to any one of claims 1 to 5 are implemented. 8.一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其特征在于,所述处理器执行所述程序时实现权利要求1至5任一项所述通信方法的步骤。8. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the communication method according to any one of claims 1 to 5 when executing the program.
CN202410606140.7A 2024-05-15 2024-05-15 A process communication method, device, medium and equipment Active CN118193254B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410606140.7A CN118193254B (en) 2024-05-15 2024-05-15 A process communication method, device, medium and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410606140.7A CN118193254B (en) 2024-05-15 2024-05-15 A process communication method, device, medium and equipment

Publications (2)

Publication Number Publication Date
CN118193254A CN118193254A (en) 2024-06-14
CN118193254B true CN118193254B (en) 2024-08-13

Family

ID=91400673

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410606140.7A Active CN118193254B (en) 2024-05-15 2024-05-15 A process communication method, device, medium and equipment

Country Status (1)

Country Link
CN (1) CN118193254B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107133109A (en) * 2017-04-24 2017-09-05 京信通信系统(广州)有限公司 A kind of method of intermodule communication, device and computing device

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5557798A (en) * 1989-07-27 1996-09-17 Tibco, Inc. Apparatus and method for providing decoupling of data exchange details for providing high performance communication between software processes
US6233729B1 (en) * 1998-10-29 2001-05-15 Nortel Networks Limited Method and apparatus for identifying dynamic structure and indirect messaging relationships between processes
US20070106998A1 (en) * 2005-10-27 2007-05-10 Zeldin Paul E Mobility system and method for messaging and inter-process communication
CN103051521A (en) * 2013-01-09 2013-04-17 浪潮电子信息产业股份有限公司 Retransmitting method of message in cloud environment
CN112822193B (en) * 2021-01-05 2023-03-24 网易(杭州)网络有限公司 Application communication method, device, equipment and storage medium
CN115373865A (en) * 2021-05-17 2022-11-22 腾讯云计算(长沙)有限责任公司 Concurrent thread management method, device, electronic equipment and storage medium
CN114816785B (en) * 2022-02-17 2025-05-27 中国平安人寿保险股份有限公司 Business data processing method, device, electronic device and storage medium
CN115827278A (en) * 2022-12-22 2023-03-21 先临三维科技股份有限公司 Cross-module communication method, system, device and storage medium
CN117194068A (en) * 2023-08-22 2023-12-08 亿咖通(湖北)技术有限公司 Cross-process data transmission method, system, equipment and storage medium

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107133109A (en) * 2017-04-24 2017-09-05 京信通信系统(广州)有限公司 A kind of method of intermodule communication, device and computing device

Also Published As

Publication number Publication date
CN118193254A (en) 2024-06-14

Similar Documents

Publication Publication Date Title
EP3873062A1 (en) Data transmission method, system, and proxy server
JP2004350188A (en) Data transfer device and program
US20140222960A1 (en) Method and Apparatus for Rapid Data Distribution
US20230080588A1 (en) Mqtt protocol simulation method and simulation device
CN113641604B (en) Data transmission method and system
CN115023919B (en) Firewall rule updating method and device, server and storage medium
WO2017032152A1 (en) Method for writing data into storage device and storage device
CN114024910A (en) Extremely-low-delay reliable communication system and method for financial transaction system
CN101699421B (en) Method and server for sharing serial port
CN111913817A (en) Data transmission method, system and equipment and computer readable storage medium
CN118193254B (en) A process communication method, device, medium and equipment
KR20220027708A (en) A method operating of a dds routing service providing apparatus processing a data priority control based on topic
CN113259408A (en) Data transmission method and system
KR20220027715A (en) A dds routing service program that provide processing a data priority control based on topic
CN118012351A (en) Data read-write order keeping method and device based on remote storage protocol, electronic equipment and storage medium
JP2009157786A (en) Message transmission control method, message transmission control device, and message transmission control program
CN112398754A (en) Data transmission method, device, medium, electronic equipment and network access equipment
CN109413142B (en) Method for realizing iSCSI virtual agent under L inux
WO2023174341A1 (en) Data read-write method, and device, storage node and storage medium
CN105912477B (en) A kind of method, apparatus and system that catalogue is read
US20200252454A1 (en) Communication device and communication method used in distributed network
CN113419669A (en) IO request processing method and device, electronic equipment and computer readable medium
CN115914288B (en) Message transmission method and device, storage medium and electronic device
CN111083066B (en) Internet of things system, device message flow method and device
CN117971748A (en) A communication method, conversion circuit and computer equipment

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
GR01 Patent grant
GR01 Patent grant