CN114661492B - Process communication method, system, terminal device and medium - Google Patents

Process communication method, system, terminal device and medium Download PDF

Info

Publication number
CN114661492B
CN114661492B CN202210210575.0A CN202210210575A CN114661492B CN 114661492 B CN114661492 B CN 114661492B CN 202210210575 A CN202210210575 A CN 202210210575A CN 114661492 B CN114661492 B CN 114661492B
Authority
CN
China
Prior art keywords
server
file address
dynamic link
link library
local
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
CN202210210575.0A
Other languages
Chinese (zh)
Other versions
CN114661492A (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.)
Shenzhen Rongan Networks Technology Co ltd
Original Assignee
Shenzhen Rongan Networks 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 Rongan Networks Technology Co ltd filed Critical Shenzhen Rongan Networks Technology Co ltd
Priority to CN202210210575.0A priority Critical patent/CN114661492B/en
Publication of CN114661492A publication Critical patent/CN114661492A/en
Application granted granted Critical
Publication of CN114661492B publication Critical patent/CN114661492B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

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

Abstract

The invention discloses a process communication method, a system, a terminal device and a computer readable storage medium, wherein the process communication method comprises the following steps: establishing a local socket file address, and receiving process information sent by a dynamic link library by monitoring a preset file descriptor mode based on the local socket file address; judging whether the current process is allowed to run or not according to the process information; and if so, obtaining a process response result and sending the process response result to the dynamic link library. Acquiring and packaging process information, and binding a local socket file address generated by a server; sending the process information to the server through the local socket file address, and waiting for the response of the server; and directly quitting after receiving a process response result sent by the server. The invention can improve the process communication efficiency.

Description

Process communication method, system, terminal device and medium
Technical Field
The present invention relates to the field of process communication technologies, and in particular, to a process communication method, a system, a terminal device, and a computer-readable storage medium.
Background
Most of the traditional process interception modes based on LD _ PRELOAD preloading generally adopt a dynamic link library to directly intercept; or the process information is sent to the main process for processing, and the main process intercepts the process information. When the main process is adopted for interception, a communication mode is often required to be introduced, and the traditional communication mode comprises the following steps: signal, udp/ip, tcp/ip, etc.
The conventional communication mechanism faces the following problems:
1. problems of database deadlock, system blocking and the like can be caused by directly intercepting the process on the preloaded dynamic library;
2. because only 32 available signals are provided for a user by the Linux system, the normal operation of other system processes or user processes can be influenced by adopting a signal mode, and a program can not be normally loaded when the system is started seriously;
3. the traditional udp/ip and tcp/ip communication modes occupy system ports, network headers need to be added or deleted in the transmission process, checksums need to be calculated, sequence numbers need to be generated, confirmation messages need to be sent, and the efficiency is affected, so that the system blocking problem can be caused.
In conclusion, the existing process communication mode has the problems of database deadlock, system blocking and the like, and the process communication efficiency is reduced.
Disclosure of Invention
The invention mainly aims to provide a process communication method, a system, a terminal device and a computer readable storage medium, aiming at improving the process communication efficiency.
In order to achieve the above object, the present invention provides a process communication method, where the process communication includes:
establishing a local socket file address, and receiving process information sent by a dynamic link library by monitoring a preset file descriptor mode based on the local socket file address;
judging whether the current process is allowed to run or not according to the process information;
and if so, obtaining a process response result, and sending the process response result to the dynamic link library according to the local socket file address.
Optionally, the server includes a main thread, the step of constructing a local socket file address, and receiving process information sent by the dynamic link library by monitoring a preset file descriptor based on the local socket file address includes:
according to the main thread, a local socket file address is constructed, and process information sent by a dynamic link library is received through a preset file descriptor monitoring mode based on the local socket file address;
after the step of receiving the process information sent by the dynamic link library, the method further includes:
and storing the process information to a preset message queue through the main thread.
Optionally, the server includes a secondary thread, and before the step of determining whether to allow the process to run according to the process information, the method further includes:
reading the process information in the message queue through the secondary thread to judge whether the current process is allowed to run or not according to the process information;
optionally, after the step of determining whether to allow the process to run according to the process information, the method further includes:
if not, the current process is directly ended.
Optionally, the process communication method is applied to a dynamic link library, and the process communication method includes the following steps:
acquiring and packaging process information, and binding a local socket file address generated by a server;
sending the process information to the server through the local socket file address, and waiting for the response of the server;
and directly quitting after receiving a process response result sent by the server.
Optionally, after the step of sending the process information to the server through the local socket file address and waiting for a response from the server, the method further includes:
and directly releasing the current process when a process response result sent by the server is not received within a preset time length.
To achieve the above object, the present invention further provides a process communication system, including:
the receiving module is used for constructing a local socket file address and receiving process information sent by the dynamic link library by monitoring a preset file descriptor mode based on the local socket file address;
the judging module is used for judging whether the current process is allowed to run or not according to the process information;
and the sending module is used for obtaining a process response result and sending the process result to the dynamic link library.
The binding module is used for acquiring and packaging the process information and binding the local socket file address generated by the server;
a response waiting module, configured to send the process information to the server through the local socket file address, and wait for a response of the server;
and the process ending module is used for returning and exiting the process after receiving the process response result sent by the server.
Each functional module of the process communication system of the present invention implements the steps of the process communication method described above when running.
In order to achieve the above object, the present invention further provides a terminal device, including: a memory, a processor and a process communication program stored on the memory and executable on the processor, the process communication program when executed by the processor implementing the steps of the process communication method as described above.
Furthermore, to achieve the above object, the present invention also provides a computer readable storage medium having stored thereon a process communication program, which when executed by a processor, implements the steps of the process communication method as described above.
Furthermore, to achieve the above object, the present invention also provides a computer program product comprising a computer program which, when executed by a processor, implements the steps of the process communication method as described above.
The present invention provides a process communication method, a system, a terminal device, a computer-readable storage medium and a computer program product, wherein the process communication method comprises the following steps: establishing a local socket file address, and receiving process information sent by a dynamic link library by monitoring a preset file descriptor mode based on the local socket file address; judging whether the current process is allowed to run or not according to the process information; and if so, obtaining a process response result and sending the process response result to the dynamic link library. Acquiring and packaging process information, and binding a local socket file address generated by a server; sending the process information to the server through the local socket file address, and waiting for the response of the server; and directly quitting after receiving a process response result sent by the server.
Compared with a process communication interception mode in the prior art, the method is a process communication mechanism based on UNIX domain socket, and the server side binds a local file address containing the file descriptor in advance, so that the client side can realize bilateral communication with the server side through a local path of the file descriptor. After the process information of the newly-built process is sent to the server through the local socket file address, the dynamic link library waits for the server end to return a process response result within the preset time length, once the server response is not received within the preset time length, the current new process is released, system blockage caused by abnormal process communication conditions is avoided, and process communication efficiency is greatly improved. In addition, the invention adopts the software main body to intercept the process, thereby avoiding the problems of database deadlock or system blockage when a plurality of processes are newly started, and the invention only occupies one file descriptor of system resources, thereby not influencing the operation of other system processes or user processes, having transmission efficiency twice as high as that of a transmission communication mode, and being capable of rapidly intercepting the process. On the basis, the method and the device realize efficient process communication, and further improve process interception efficiency.
Drawings
FIG. 1 is a schematic diagram of a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a first flowchart of a process communication method according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating a call to a dynamic link library according to an embodiment of the process communication method of the present invention;
FIG. 4 is a diagram illustrating server-side process communication and process interception according to an embodiment of the process communication method of the present invention;
FIG. 5 is a second flowchart illustrating a process communication method according to an embodiment of the present invention;
FIG. 6 is a schematic diagram illustrating a process information transmission of a dynamic link library according to an embodiment of a process communication method of the present invention;
FIG. 7 is a first diagram of functional blocks of the process communication system according to an embodiment of the present invention;
fig. 8 is a second schematic diagram of functional modules of a process communication system according to an embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not limit the invention.
As shown in fig. 1, fig. 1 is a schematic device structure diagram of a hardware operating environment according to an embodiment of the present invention.
It should be noted that, the terminal device in the embodiment of the present invention may be a terminal device for implementing process communication, and the terminal device may specifically be a server, a dynamic link library, and the like.
As shown in fig. 1, the apparatus may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, a communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the configuration of the apparatus shown in fig. 1 is not intended to be limiting of the apparatus and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is a kind of computer storage medium, may include therein an operating system, a network communication module, a user interface module, and a process communication program. An operating system is a program that manages and controls the hardware and software resources of a device, supporting the execution of process communication programs and other software or programs. In the device shown in fig. 1, the user interface 1003 is mainly used for data communication with a client; the network interface 1004 is mainly used for establishing communication connection with a server; and the processor 1001 may be configured to invoke a process communication program stored in the memory 1005 and perform the following operations:
establishing a local socket file address, and receiving process information sent by a dynamic link library by monitoring a preset file descriptor mode based on the local socket file address;
judging whether the current process is allowed to run or not according to the process information;
and if so, obtaining a process response result, and sending the process response result to the dynamic link library according to the local socket file address.
Further, the processor 1001 may be further configured to invoke a process communication program stored in the memory 1005, and further perform the following operations:
according to the main thread, a local socket file address is constructed, and process information sent by a dynamic link library is received through a preset file descriptor monitoring mode based on the local socket file address;
after the step of receiving the process information sent by the dynamic link library, the processor 1001 may be further configured to call the process communication program stored in the memory 1005, and further perform the following operations:
and storing the process information to a preset message queue through the main thread.
Further, the server includes a sub-thread, and before the step of determining whether to allow the process to run according to the process information, the processor 1001 may be further configured to call a process communication program stored in the memory 1005, and further perform the following operations:
reading the process information in the message queue through the secondary thread to judge whether the current process is allowed to run or not according to the process information;
further, after the step of determining whether to allow the process to run according to the process information, the processor 1001 may be further configured to call the process communication program stored in the memory 1005, and further perform the following operations:
if not, the current process is directly ended.
Further, the processor 1001 may be further configured to invoke a process communication program stored in the memory 1005, and further perform the following operations:
acquiring and packaging process information, and binding a local socket file address generated by a server;
sending the process information to the server through the local socket file address, and waiting for the response of the server;
and directly quitting after receiving a process response result sent by the server.
Further, after the step of sending the process information to the server through the local socket file address and waiting for the server to answer, the processor 1001 may be further configured to call a process communication program stored in the memory 1005, and further perform the following operations:
and directly releasing the current process when a process response result sent by the server is not received within a preset time length.
Referring to fig. 2, fig. 2 is a first flowchart of a process communication method according to a first embodiment of the present invention.
In this embodiment, an embodiment of a process communication method applied to a server is provided. It should be noted that, although a logical order is illustrated in the flow chart, in some cases, the steps shown or described may be performed in an order different than that illustrated.
The UNIX domain protocol is not a real family of protocols, but rather a way to perform client/service communications on a single host is a way to inter-process communications (IPC). It provides two types of sockets: byte stream sockets (like TCP) and datagram sockets (like UDP). The UNIX domain datagram service is reliable, no messages are lost, and no errors are delivered. Compared with the identification of the client server by the IP address and the port number by the IP protocol, the identification of the protocol addresses of the client and the server by the path name in the common file system in the UNIX domain protocol.
In addition, the LD _ PRELOAD dynamic link library preloading mechanism is a way for the system to provide a user to run a custom dynamic link library, and a technique for preloading a user-defined dynamic link library before the executable program runs can rewrite the library functions of the system, and only redefine the library functions with the same name in the preloaded link library. Thus, when the program calls the library function, the redefined function will short circuit the normal library function. The function of the dynamic library hook is communicated with the software main process and logically judged by the main process, so that the effect of intercepting one process is achieved.
In the embodiment, the process communication mechanism is based on UNIX domain sockets, only one file descriptor needs to be bound by the server on the local system, and the dynamic link library loaded when the client creates the process can perform bilateral communication with the server through the local path of the file descriptor. Because the mode adopts the mode of realizing interception by the software main process and adopting multithreading, the problems of database deadlock or system blockage caused when a system starts up a plurality of processes are avoided. The method occupies only one file descriptor of system resources, so that the operation of other system processes or user processes is not influenced, the transmission efficiency can be twice as high as that of a transmission communication method, and the processes can be intercepted more quickly.
Step S10, a local socket file address is constructed, and process information sent by a dynamic link library is received by monitoring a preset file descriptor based on the local socket file address;
the server establishes a UNIX socket (UNIXsocket) in advance, binds a local file address to obtain the local socket file address, and circularly waits for receiving the process information sent by the dynamic link library based on the local socket file address in a mode of monitoring a file descriptor.
It should be noted that, in this embodiment, as shown in fig. 3, in the process of loading the dynamic link LIBRARY of the Linux operating system, the dynamic link device reads the value of the LD _ PRELOAD environment variable and the file content of the default configuration file/etc/ld.so.preload, and PRELOADs the read dynamic link LIBRARY, even if the program does not depend on these dynamic link libraries, the dynamic link libraries specified in the LD _ PRELOAD environment variable and/etc/ld.so.preload configuration file are still loaded, and their priority is higher than the file priority of the link LIBRARY search PATH defined by the LD _ LIBRARY _ PATH environment variable, so that the dynamic link LIBRARY loading can be performed in advance of the dynamic LIBRARY loading called by the user. Each file descriptor corresponds to an open file, and different file descriptors point to the same file. The same file may be opened by different processes or may be opened multiple times in the same process. The system maintains a file descriptor table for each process.
Step S20, judging whether the current process is allowed to run or not according to the process information;
and step S30, if so, obtaining a process response result, and sending the process response result to the dynamic link library according to the local socket file address.
After receiving the process information sent by the dynamic link library, the server side further judges whether the process is allowed to run according to the process information. And if the server judges that the process is allowed to run according to the process information, returning a process response result to the dynamic link library through the local socket file address.
In this embodiment, the server establishes a UNIX socket (UNIX socket) in advance, binds a local file address, and obtains a local socket file address, so as to circularly wait for receiving process information sent by the dynamic link library based on the local socket file address and by monitoring a file descriptor. After receiving the process information sent by the dynamic link library, the server side further judges whether the process is allowed to run according to the process information. And if the server judges that the process is allowed to run according to the process information, returning a process response result to the dynamic link library through the local socket file address.
Compared with a process communication interception mode in the prior art, the method is a process communication mechanism based on UNIX domain socket, and the server side binds a local file address containing the file descriptor in advance, so that the client side can realize bilateral communication with the server side through a local path of the file descriptor. The invention adopts the software main body to intercept the process, avoids the problems of database deadlock or system deadlock when a plurality of processes are started up by the system, occupies only one file descriptor as a system resource, does not influence the operation of other system processes or user processes, has twice transmission efficiency of a transmission communication mode, and can intercept the process more quickly. On the basis, the invention realizes high-efficiency process communication and process interception.
Further, based on the above first embodiment of the process communication method of the present invention, a second embodiment of the process communication method of the present invention is proposed.
The difference between this embodiment and the first embodiment is that, in this embodiment, in the step S10, "building a local socket file address, and receiving process information sent by the dynamic link library by monitoring a preset file descriptor based on the local socket file address" may include:
step S101, a local socket file address is constructed according to the main thread, and process information sent by a dynamic link library is received by monitoring a preset file descriptor based on the local socket file address;
it should be noted that, in this embodiment, to avoid the problems of database deadlock and system deadlock, a double thread is used to implement process communication and process interception, and the double thread includes a main thread and a secondary thread.
Specifically, for example, as shown in fig. 4, the server first establishes a UNIX socket through the main thread, and binds the local file address, thereby obtaining the local socket file address, and circularly waits for receiving the process information sent by the dynamic link library based on the local socket file address and by monitoring the file descriptor until the process information sent by the dynamic link library is received.
After the step S101, the method further includes:
and step S102, storing the process information to a preset message queue through the main thread.
After the server receives the process information sent by the dynamic link library through the main thread, in order to judge whether the process is allowed to run through the secondary thread of the server, the server stores the process information into a preset message queue through the main thread, so that the secondary thread can acquire the process information from the message queue.
Further, before the step S20, "determining whether to allow the current process to run according to the process information", the method further includes:
step S40, reading the process information in the message queue through the secondary thread to judge whether the current process is allowed to run or not according to the process information;
after a main thread of the server receives process information sent by the dynamic link library and stores the process information into a message queue, a secondary thread of the server reads the process information from the message queue so as to judge whether a current process runs or not according to the process information.
Further, after the step S20 of determining whether to allow the current process to run according to the process information, the method may further include:
and S50, if not, directly ending the current process.
The server acquires the process information from the message queue through the secondary thread, judges whether the current process can be allowed to run according to the process information, and directly ends the current process without allowing the process to run when judging that the process is not allowed to run according to the process information.
In this embodiment, the server first establishes a UNIX socket and binds a local file address through a main thread, so as to obtain a local socket file address, and circularly waits for receiving the process information sent by the dynamic link library based on the local socket file address in a manner of monitoring a file descriptor until the process information sent by the dynamic link library is received. After a main thread of the server receives process information sent by the dynamic link library and stores the process information into a message queue, a secondary thread of the server reads the process information from the message queue so as to judge whether a current process runs or not according to the process information. When the process is judged not to be allowed to run according to the process information, the current process is directly killed, and the process is not allowed to run.
In the invention, the server adopts the main thread to receive the process information sent by the dynamic link library and stores the process information into a message queue, and adopts the auxiliary thread to judge the process information so as to determine whether to operate the current process. Therefore, the process communication and process interception of the server and the dynamic link library are realized in a double-thread mode, the problem of database locking is solved, the message transmission efficiency is high, the transmission speed is twice of that of the traditional tcp/ip udp/ip, and the process communication method is suitable for most linux systems and unix systems.
Further, a third embodiment of the process communication method of the present invention is proposed based on the above first and second embodiments of the process communication method of the present invention.
Compared with the first embodiment and the second embodiment, in this embodiment, referring to fig. 5, fig. 5 is a second flowchart of a third embodiment of a process communication method according to the present invention.
In this embodiment, an embodiment of a process communication method applied to a dynamically linked library is provided. It should be noted that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described may be performed in an order different than that shown or described herein.
Step S70, acquiring and packaging the process information, and binding a local socket file address generated by the server;
step S80, sending the process information to the server through the local socket file address, and waiting for the response of the server;
and step S90, directly quitting after receiving the process response result sent by the server.
It should be noted that, in this embodiment, when a new process is established by the client, the corresponding dynamic link library is loaded according to the new process, so as to obtain the process information of the current process through the dynamic link library.
Specifically, for example, as shown in fig. 6, the dynamic link library obtains and packages process information of a newly created process through a hook system api, binds a local socket file address generated by the server, sends the process information to the server through the bound local socket file address according to the UNIX socket mode, and blocks a response waiting for receiving the server. After receiving the process response result sent by the server, the dynamic link library directly returns and exits the current dynamic link library so as to load other dynamic link libraries again according to the process.
Further, after the step S80, "sending the process information to the server through the local socket file address, and waiting for a response from the server", the method may further include:
and step A, directly releasing the current process when a process response result sent by the server is not received within a preset time length.
It should be noted that, in this embodiment, in order to avoid a system deadlock caused by the fact that the dynamic link library does not receive a process response result returned by the server for a long time, a preset time duration, that is, a timeout time, may be preset.
Specifically, for example, if a message of the server has not been received within the timeout time, the current process is directly released. In this embodiment, setting the timeout is also a bottom-trapping measure to prevent system deadlock due to abnormal conditions, so as to improve process communication efficiency.
In this embodiment, the process information of the new process of the dynamic link library is packaged, the local socket file address generated by the server is bound, the process information is sent to the server through the bound local socket file address, and the response of the server waiting to be received is blocked. And after receiving a process response result sent by the server, the dynamic link library directly returns and exits the current process, and if the message of the server is not received within the overtime, the current process is directly released.
In the invention, after the process information of the newly-built process is sent to the server through the local socket file address, the dynamic link library waits for the server end to return a process response result within the preset time length, and once the server response is not received within the preset time length, the current new process is released, so that the system blockage caused by the communication condition of the abnormal process is avoided, and the process communication efficiency is greatly improved.
In addition, an embodiment of the present invention further provides a process communication system, where the process communication system is applied to a server, referring to fig. 7, fig. 7 is a first schematic diagram of a functional module according to an embodiment of process communication in the present invention. As shown in fig. 7, the process communication system of the present invention includes:
the receiving module 10 is configured to construct a local socket file address, and receive process information sent by a dynamic link library by monitoring a preset file descriptor based on the local socket file address;
a judging module 20, configured to judge whether to allow the current process to run according to the process information;
and the sending module 30 is configured to obtain a process response result, and send the process response result to the dynamic link library according to the local socket file address.
Further, the server includes a main thread, and the receiving module 10 includes:
the receiving unit is used for constructing a local socket file address according to the main thread and receiving process information sent by the dynamic link library by monitoring a preset file descriptor based on the local socket file address;
further, the process communication system further includes:
and the storage module is used for storing the process information to a preset message queue through the main thread.
Further, the process communication system further includes:
the reading module is used for reading the process information in the message queue through the secondary thread so as to judge whether the current process is allowed to run or not according to the process information;
further, the process communication system further includes:
and the process ending module is used for directly ending the current process if the current process is not ended.
The specific implementation of each functional module of the process communication system of the present invention is basically the same as that of each embodiment of the process communication method described above, and is not described herein again.
In addition, an embodiment of the present invention further provides a process communication system, where the process communication system is applied to a server, referring to fig. 8, and fig. 8 is a second schematic diagram of a functional module according to an embodiment of the process communication system. As shown in fig. 8, the process communication system of the present invention includes:
the binding module 40 is used for acquiring and packaging the process information and binding the local socket file address generated by the server;
a wait response module 50, configured to send the process information to the server through the local socket file address, and wait for a response of the server;
and a process ending module 60, configured to exit directly after receiving the process response result sent by the server.
Further, the process communication system further includes:
and the releasing progress module is used for directly releasing the current progress when the progress response result sent by the server is not received within a preset time length.
The specific implementation of each functional module of the process communication system of the present invention is basically the same as that of each embodiment of the process communication method described above, and is not described herein again.
Furthermore, an embodiment of the present invention further provides a computer-readable storage medium, where a process communication program is stored, and when executed by a processor, the process communication program implements the steps of the process communication method described above.
The embodiments of the process communication system and the computer-readable storage medium of the present invention can refer to the embodiments of the process communication method of the present invention, and are not described herein again.
Furthermore, an embodiment of the present invention also provides a computer program product, which includes a computer program that, when being executed by a processor, implements the steps of the process communication method according to any one of the above embodiments of the process communication method.
The specific embodiment of the computer program product of the present invention is substantially the same as the embodiments of the process communication method described above, and is not described herein again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a component of' 8230; \8230;" does not exclude the presence of another like element in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are only for description, and do not represent the advantages and disadvantages of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention essentially or contributing to the prior art may be embodied in the form of a software product, which is stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g. server, dynamic link library, etc.) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A process communication method is applied to a server, and comprises the following steps:
establishing a local socket file address through a main thread of the server, and receiving process information sent by a dynamic link library through monitoring a preset file descriptor mode based on the local socket file address, wherein the dynamic link library is obtained by user-defined and pre-loaded;
judging whether the current process is allowed to run or not according to the process information through a secondary thread of the server;
if so, obtaining a process response result, and sending the process response result to the dynamic link library according to the local socket file address;
wherein the constructing the local socket file address comprises:
and building a UNIX socket, and binding the UNIX socket with a local file address to obtain the local socket file address.
2. The process communication method according to claim 1, further comprising, after the step of receiving the process information sent by the dynamic link library:
and storing the process information to a preset message queue through the main thread.
3. The process communication method according to claim 2, wherein before the step of determining whether to allow the process to run based on the process information, further comprising:
and reading the process information in the message queue through the secondary thread so as to judge whether the current process is allowed to run through the secondary thread according to the process information.
4. The process communication method according to claim 1, wherein after the step of determining whether to allow the process to run based on the process information, further comprising:
if not, the current process is directly ended.
5. A process communication method is applied to a dynamic link library, wherein the dynamic link library is customized by a user and is obtained by pre-loading, and the process communication method comprises the following steps:
acquiring and packaging process information, and binding a local socket file address generated by a server, wherein the local socket file address is obtained by constructing a UNIX socket by the server and binding the UNIX socket with the local file address;
sending the process information to the server through the local socket file address, and waiting for the response of the server;
and directly quitting after receiving a process response result sent by the server.
6. The process communication method according to claim 5, further comprising, after the step of sending the process information to the server through the local socket file address and waiting for a reply from the server:
and directly releasing the current process when the process response result sent by the server is not received within a preset time length.
7. A process communication system applied to a server, the process communication system comprising:
the receiving module is used for constructing a local socket file address through a main thread of the server and receiving process information sent by a dynamic link library through monitoring a preset file descriptor mode on the basis of the local socket file address, wherein the dynamic link library is obtained by user-defined and pre-loaded;
the judging module is used for judging whether the current process is allowed to run or not according to the process information through the secondary process of the server;
the sending module is used for obtaining a process response result and sending the process response result to the dynamic link library according to the local socket file address;
wherein, the receiving module comprises:
and the building unit is used for building a UNIX socket and binding the UNIX socket with a local file address to obtain the local socket file address.
8. A process communication system, which is applied to a dynamic link library, wherein the dynamic link library is customized by a user and is obtained by pre-loading, and the process communication system comprises:
the binding module is used for acquiring and packaging process information and binding a local socket file address generated by the server, wherein the local socket file address is obtained by constructing a UNIX socket by the server and binding the UNIX socket with the local file address;
a response waiting module, configured to send the process information to the server through the local socket file address, and wait for a response of the server;
and the process ending module is used for returning and exiting the process after receiving the process response result sent by the server.
9. A terminal device, characterized in that the terminal device comprises a memory, a processor and a process communication program stored on the memory and executable on the processor, which process communication program, when executed by the processor, implements the steps of the process communication method according to any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that a process communication program is stored thereon, which, when being executed by a processor, implements the steps of the process communication method according to any one of claims 1 to 6.
CN202210210575.0A 2022-03-03 2022-03-03 Process communication method, system, terminal device and medium Active CN114661492B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210210575.0A CN114661492B (en) 2022-03-03 2022-03-03 Process communication method, system, terminal device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210210575.0A CN114661492B (en) 2022-03-03 2022-03-03 Process communication method, system, terminal device and medium

Publications (2)

Publication Number Publication Date
CN114661492A CN114661492A (en) 2022-06-24
CN114661492B true CN114661492B (en) 2023-04-07

Family

ID=82027111

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210210575.0A Active CN114661492B (en) 2022-03-03 2022-03-03 Process communication method, system, terminal device and medium

Country Status (1)

Country Link
CN (1) CN114661492B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114979233A (en) * 2022-07-19 2022-08-30 深圳市亿联无限科技有限公司 Method and system for realizing synchronous and asynchronous call between modules based on domain socket
CN117278327B (en) * 2023-11-21 2024-01-26 北京熠智科技有限公司 Access control method and system for network request

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101304409A (en) * 2008-06-28 2008-11-12 华为技术有限公司 Method and system for detecting malice code
CN110875910A (en) * 2018-08-31 2020-03-10 阿里巴巴集团控股有限公司 Method, device and system for acquiring network transmission information
CN112631788A (en) * 2021-01-06 2021-04-09 上海哔哩哔哩科技有限公司 Data transmission method and data transmission server
CN113010333A (en) * 2021-03-24 2021-06-22 北京中电兴发科技有限公司 Multi-scene inter-process communication method suitable for Linux server cluster

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112749023A (en) * 2019-10-30 2021-05-04 阿里巴巴集团控股有限公司 Information processing method, device, equipment and system
CN112906075A (en) * 2021-03-15 2021-06-04 北京字节跳动网络技术有限公司 Memory sharing method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101304409A (en) * 2008-06-28 2008-11-12 华为技术有限公司 Method and system for detecting malice code
CN110875910A (en) * 2018-08-31 2020-03-10 阿里巴巴集团控股有限公司 Method, device and system for acquiring network transmission information
CN112631788A (en) * 2021-01-06 2021-04-09 上海哔哩哔哩科技有限公司 Data transmission method and data transmission server
CN113010333A (en) * 2021-03-24 2021-06-22 北京中电兴发科技有限公司 Multi-scene inter-process communication method suitable for Linux server cluster

Also Published As

Publication number Publication date
CN114661492A (en) 2022-06-24

Similar Documents

Publication Publication Date Title
CN114661492B (en) Process communication method, system, terminal device and medium
US11392429B2 (en) Modifying application behaviour
US6678734B1 (en) Method for intercepting network packets in a computing device
EP1891787B1 (en) Data processing system
US7437547B2 (en) Method and computer program product for offloading processing tasks from software to hardware
US7127526B1 (en) Method and apparatus for dynamically loading and managing software services on a network device
US8291486B2 (en) Gateway device having socket library for monitoring, communication method of gateway device having socket library for monitoring, and communication program of gateway device having socket library for monitoring
US7840633B2 (en) Communicating messages between components in a client/server environment using an object broker
US7116675B2 (en) Methods and systems for transferring packets and preventing illicit access
US9015822B2 (en) Automatic invocation of DTN bundle protocol
US7631175B2 (en) Control protocol for image enumeration and transfer
US8732694B2 (en) Method and system for performing services in server and client of client/server architecture
US11954530B2 (en) Method and system of processing data based on QUIC protocol stack, device and storage medium
US20080141358A1 (en) Identification and administration system applied to peer-to-peer gateway and method for the same
CN111475314B (en) Processing method, device, equipment and storage medium for network request
CN111522663A (en) Data transmission method, device and system based on distributed storage system
CN113645308A (en) Mobile terminal TCP communication, device, equipment and storage medium
GB2436627A (en) Message handling using a wrapper
CN108712298B (en) Network equipment upgrading method and device, network equipment and storage medium
CN114244758A (en) Network diagnosis method, storage medium, electronic device and system of android platform
CN114489847A (en) Method, system, device and storage medium for managing and controlling process manager
CN112667359A (en) Data transparent transmission method, electronic equipment and storage medium
Chesneau Gunicorn documentation
US6802065B1 (en) System and methods for permitting access to a singular network process by multiple user processes
US8521701B2 (en) Reducing data transfer for matching patterns

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