CN107665148A - A kind of name pipeline Way of Process Communication based on Chromium - Google Patents

A kind of name pipeline Way of Process Communication based on Chromium Download PDF

Info

Publication number
CN107665148A
CN107665148A CN201610609011.9A CN201610609011A CN107665148A CN 107665148 A CN107665148 A CN 107665148A CN 201610609011 A CN201610609011 A CN 201610609011A CN 107665148 A CN107665148 A CN 107665148A
Authority
CN
China
Prior art keywords
event
socket
server
libevent
bound
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.)
Granted
Application number
CN201610609011.9A
Other languages
Chinese (zh)
Other versions
CN107665148B (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.)
Institute of Acoustics CAS
Shanghai 3Ntv Network Technology Co Ltd
Original Assignee
Institute of Acoustics CAS
Shanghai 3Ntv Network 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 Institute of Acoustics CAS, Shanghai 3Ntv Network Technology Co Ltd filed Critical Institute of Acoustics CAS
Priority to CN201610609011.9A priority Critical patent/CN107665148B/en
Publication of CN107665148A publication Critical patent/CN107665148A/en
Application granted granted Critical
Publication of CN107665148B publication Critical patent/CN107665148B/en
Expired - Fee Related 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/542Event management; Broadcasting; Multicasting; Notifications
    • 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/544Buffers; Shared memory; Pipes

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 invention discloses a kind of name pipeline Way of Process Communication based on Chromium, methods described includes:Server ends and Client ends are respectively created to UNIX Domain Sockets of the process A and B that needs communicate based on name pipeline, and generate corresponding Socket handles fd1 and fd2, event of two Socket handles respectively with Libevent is bound, when Client ends initiate to ask to Server ends, the event of Server ends binding is triggered, generate the Socket handles fd3 for communication, and bound with Libevent event, then Server ends send and receive message using handle fd3 and event, Client ends send and receive message using handle fd2 and event.UNIX Domain Socket of the method for the present invention based on name pipeline, can complete the communication between any process, compared with Chromium is original, the scope of application of process is wider.

Description

A kind of name pipeline Way of Process Communication based on Chromium
Technical field
The present invention relates to the IPC communications fields, more particularly to a kind of name pipeline Way of Process Communication based on Chromium.
Background technology
With Internet popularization and popularization, browser gradually shows more as the important entrance for accessing internet Sample, the trend complicated, especially HTML5 formulation, it imply that browser has thoroughly been taken leave of based on browsing webpage, search for Want function old times, and gradually to simulation even substitution operating system realize that the Web OS epoch of its types of functionality extend; And being surging forward for mobile Internet, then exacerbate the conversion of this process.These trend are that browser brings new opportunity Meanwhile very big challenge is also brought, current browser will not only have abundant displaying function, also there is stable performance body Test and reliable safety guarantee.
Chrome (Chromium) browser relies on open source projects Chromium, compared to IE, Firefox, Oprah etc. For like product, there are many advantages;Chromium (Chrome browsers) takes the lead in using multi-process framework, avoids single The page or Web application collapse and influence the stability of whole browser;Using multi-thread mechanism, when reducing page response Between, improve efficiency;Using inter-process communication mechanisms, the interactive cooperation between different processes is completed.
The UNIX Domain Socket based on Anonymous Pipes are used inside original Chromium, are used Socketpair functions complete the foundation of communication pipe, and advantage is without carrying out extra binding to the socket of generation, monitoring And attended operation, it is created that before subprocess generation and completes the required fd of subprocess communication, expense is smaller;Shortcoming is only can be with Complete the communication between father and son's process, it is impossible to realize the communication between any process.UNIX Domain based on name pipeline Socket is similar with general network Socket, and the difference of the two programming is as follows:
1., address family be AF_UNIX;
2nd, because being applied to IPC, this type UNIX Domain Socket do not need IP and port, instead It is to be represented with structure sockaddr_un, this and structure describe the file of a Socket type in file system Path, this Socket file is called by bind () and created, if this document is existing when calling bind (), bind () is wrong Return by mistake;
3rd, UNIX Domain Socket Client ends typically will explicitly call bind functions, rather than network Socket Equally rely on the address that system is distributed automatically.Client bind Socket filenames can include the pid of client, so take Device can of being engaged in distinguishes different Client ends.
The content of the invention
It is an object of the invention to overcome the current Chromium UNIX Domain Socket based on Anonymous Pipes only The limitation of the communication between father and son's process can be realized, there is provided a kind of name pipeline Way of Process Communication based on Chromium, should Although method needs to carry out extra binding, monitoring and attended operation, the fd needed for process communication is needed after process creation It could create, expense increased, but the scope of application of process is wider, can complete the communication between any process.
To achieve these goals, the invention provides a kind of name pipeline Way of Process Communication based on Chromium, Methods described includes:UNIX Domain Sockets of the process A and B that needs communicate based on name pipeline is respectively created Server ends and Client ends, and generate corresponding Socket handles fd1 and fd2, two Socket handles respectively with Libevent event is bound, and when Client ends initiate to ask to Server ends, the event of Server ends binding is touched Hair, generates the Socket handle fd3 for communication, and is bound with Libevent event, then Server ends utilize handle Fd3 and event send and receive message, and Client ends send and receive message using handle fd2 and event.
In above-mentioned technical proposal, methods described specifically includes:
Step 1), which creates two, to be needed to carry out communication process:Process A and process B;
Step 2) process A creates a Server end, generation by the UNIX Domain Socket based on name pipeline Corresponding Socket fd:Fd1, and fd1 is bound and monitored;A fd1 and Libevent event is bound, from And Libevent is allowed to be monitored it;
Step 3) process B creates a Client end, generation by the UNIX Domain Socket based on name pipeline Corresponding Socket fd:Fd2, fd2 is bound and initiates connection request to Server ends;
After step 4) obtains connection request when Server ends, event bound Libevent can be triggered, and notify Server ends call back function accept, accept functions return to success value and represent that Server ends have received connection, and generate new For the Socket fd that are communicated with process B:fd3;
After step 5) Server terminations are connected, Client ends can send a Hello Message to Server ends, such as Fruit Server ends receive, then connection has built up;
Step 6) Server ends are by a fd3 and Libevent event binding;
Step 7) process A and process B is established after connection, and process A is communicated using fd3 with Client ends, process B profits Communicated with fd2 with Server ends;When wherein message is sent out in one end to the other end, bound in other end Socket fd Libevent events can be triggered, notify this end handle message.
The technical advantages of the present invention are that:
The UNIX Domain Socket based on Anonymous Pipes are used inside original Chromium, can only be completed Communication between father and son's process, and the fd completed needed for subprocess communication is created that before subprocess generation;The present invention Method based on name pipeline UNIX Domain Socket, the communication between any process can be completed, with Chromium Original to compare, the scope of application of process is wider.
Brief description of the drawings
Fig. 1 is the Establishing process schematic diagram for the name pipeline IPC communication mechanisms based on Chromium that the present invention realizes;
Fig. 2 be after the name pipeline IPC communication mechanisms based on Chromium that the present invention realizes are established the transmission of message with Handling process schematic diagram.
Embodiment
Present disclosure is described in further detail below in conjunction with the accompanying drawings.
As shown in figure 1, a kind of name pipeline Way of Process Communication based on Chromium, methods described include:
Step 1), which creates two, to be needed to carry out communication process:Process A and process B;
Step 2) process A creates a Server end, generation by the UNIX Domain Socket based on name pipeline Corresponding Socket fd:Fd1, and fd1 is bound and monitored;A fd1 and Libevent event is bound, from And Libevent is allowed to be monitored it;
Step 3) process B creates a Client end, generation by the UNIX Domain Socket based on name pipeline Corresponding Socket fd:Fd2, fd2 is bound and initiates connection request to Server ends;
After step 4) obtains connection request when Server ends, event bound Libevent can be triggered, and notify Server ends call back function accept, accept functions return to success value and represent that Server ends have received connection, and generate new For the Socket fd that are communicated with process B:fd3;
After step 5) Server terminations are connected, Client ends can send a Hello Message to Server ends, such as Fruit Server ends receive, then connection has built up;
Step 6) Server ends are by a fd3 and Libevent event binding;
Step 7) process A and process B is established after connection, and process A (Server ends) is led to using fd3 and Client ends Letter, process B (Client ends) are communicated using fd2 with Server ends;When wherein message is sent out in one end to the other end, separately Libevent events bound in the fd of one end can be triggered, and notify this end to handle message.
As shown in Fig. 2 after name pipeline Interprocess Communication Mechanism is established among Chromium, the transmission of message and place Managing flow is:
When having IPC message to need to send, message is submitted to ChannelProxy by Sender by send methods Class.If synchronization message (after synchronization message refers to that IPC message is sent to recipient by sender, can wait recipient to return A multiple IPC message), then need to submit to the completion of SyncChannel classes.The two classes receive the request for sending IPC message Afterwards, the IPC message that will can be sent is transmitted to ChannelPosix processing., will after ChannelPosix receives message It is put among message queue, and by calling sendmsg or write to be written into UNIX Domain Socket.
Due to IPC::Listener is used for creating the Socket of IPC channel by I/O thread monitors, therefore when should When Socket has new data readable, the Listener cans at Server ends obtain a new reading (EV_ by Libevent READ) event notifies.The EV_READ events can trigger ChannelPosix and message is taken out from message queue, and give ChannelReader.ChannelReader obtain IPC message after, be first transmitted to be registered in ChannelProxy or Message Filter among SyncChannel, ask whether to need to handle message to it.If necessary to handle, then hand over Handled to them;If it is not required, then pass to Listener.Listener equally can also only handle a part of IPC message, For oneself uninterested IPC message, Listener, which can will be forwarded to, to be registered at a series of its internal Route Reason.
Above-described embodiment, the purpose of the present invention, technical scheme and beneficial effect are carried out further Describe in detail, should be understood that the embodiment that the foregoing is only the present invention, be not intended to limit the present invention Protection domain, within the spirit and principles of the invention, any modification, equivalent substitution and improvements done etc., all should include Within protection scope of the present invention.

Claims (2)

1. a kind of name pipeline Way of Process Communication based on Chromium, methods described include:To the process A that communicates of needs and Server ends and Client ends is respectively created in UNIX Domain Socket of the B based on name pipeline, and generates corresponding Socket handles fd1 and fd2, event of two Socket handles respectively with Libevent are bound, when Client ends to When request is initiated at Server ends, the event of Server ends binding is triggered, and generates the Socket handle fd3 for communication, and with Libevent event is bound, then Server ends send and receive message using handle fd3 and event, and Client ends utilize Handle fd2 and event send and receive message.
2. the name pipeline Way of Process Communication according to claim 1 based on Chromium, it is characterised in that the side Method specifically includes:
Step 1), which creates two, to be needed to carry out communication process:Process A and process B;
Step 2) process A creates a Server end by the UNIX Domain Socket based on name pipeline, and generation is corresponding Socket fd:Fd1, and fd1 is bound and monitored;A fd1 and Libevent event is bound, so as to allow Libevent is monitored to it;
Step 3) process B creates a Client end by the UNIX Domain Socket based on name pipeline, and generation is corresponding Socket fd:Fd2, fd2 is bound and initiates connection request to Server ends;
After step 4) obtains connection request when Server ends, event bound Libevent can be triggered, and notify Server End call back function accept, accept function returns to success value and represents that Server ends have received connection, and generates new be used for The Socket fd to be communicated with process B:fd3;
After step 5) Server terminations are connected, Client ends can send a Hello Message to Server ends, if Server ends receive, then connection has built up;
Step 6) Server ends are by a fd3 and Libevent event binding;
Step 7) process A and process B is established after connection, and process A is communicated using fd3 with Client ends, and process B is utilized Fd2 is communicated with Server ends;When wherein message is sent out in one end to the other end, bound in other end Socket fd Libevent events can be triggered, and notify this end to handle message.
CN201610609011.9A 2016-07-28 2016-07-28 Named pipeline process communication method based on Chromium Expired - Fee Related CN107665148B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610609011.9A CN107665148B (en) 2016-07-28 2016-07-28 Named pipeline process communication method based on Chromium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610609011.9A CN107665148B (en) 2016-07-28 2016-07-28 Named pipeline process communication method based on Chromium

Publications (2)

Publication Number Publication Date
CN107665148A true CN107665148A (en) 2018-02-06
CN107665148B CN107665148B (en) 2020-06-16

Family

ID=61114577

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610609011.9A Expired - Fee Related CN107665148B (en) 2016-07-28 2016-07-28 Named pipeline process communication method based on Chromium

Country Status (1)

Country Link
CN (1) CN107665148B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108833578A (en) * 2018-06-30 2018-11-16 武汉斗鱼网络科技有限公司 The method and relevant device of duplex communication are carried out based on FIFO name pipeline
CN111181992A (en) * 2020-01-03 2020-05-19 平安科技(深圳)有限公司 Communication method, device, equipment and storage medium of nodes and chain codes in block chain
CN111385251A (en) * 2018-12-28 2020-07-07 武汉斗鱼网络科技有限公司 Method, system, server and storage medium for improving operation stability of client

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101963924A (en) * 2010-10-21 2011-02-02 深圳创维-Rgb电子有限公司 Process communication method, device and operating system
CN102135917A (en) * 2010-11-30 2011-07-27 广东星海数字家庭产业技术研究院有限公司 Inter-Linux operating system progress communication information acquisition method
US8280955B1 (en) * 2010-07-15 2012-10-02 Symantec Corporation Systems and methods for handling client-server communications
CN102833080A (en) * 2011-06-15 2012-12-19 康佳集团股份有限公司 Process-to-process communication method of application software and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8280955B1 (en) * 2010-07-15 2012-10-02 Symantec Corporation Systems and methods for handling client-server communications
CN101963924A (en) * 2010-10-21 2011-02-02 深圳创维-Rgb电子有限公司 Process communication method, device and operating system
CN102135917A (en) * 2010-11-30 2011-07-27 广东星海数字家庭产业技术研究院有限公司 Inter-Linux operating system progress communication information acquisition method
CN102833080A (en) * 2011-06-15 2012-12-19 康佳集团股份有限公司 Process-to-process communication method of application software and system

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
HORKY: "Chromium多进程机制解析", 《HTTPS://BLOG.CSDN.NET/HORKYCHEN/ARTICLE/DETAILS/44516633》 *
正版风之彼岸: "chromium进程间通信-ChannelImpl", 《HTTPS://BLOG.CSDN.NET/LJM198745/ARTICLE/DETAILS/40710557》 *
罗升阳: "Chromium的Render进程启动过程分析", 《HTTPS://BLOG.CSDN.NET/LUOSHENGYANG/ARTICLE/DETAILS/47433765》 *
西昆仑: "CHROME进程间通信", 《HTTP://WEB.ARCHIVE.ORG/WEB/20121009023145/HTTPS://MY.OSCHINA.NET/MYSPACENUAA/BLOG/81632》 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108833578A (en) * 2018-06-30 2018-11-16 武汉斗鱼网络科技有限公司 The method and relevant device of duplex communication are carried out based on FIFO name pipeline
CN108833578B (en) * 2018-06-30 2021-07-23 武汉斗鱼网络科技有限公司 Method and related equipment for duplex communication based on FIFO named pipeline
CN111385251A (en) * 2018-12-28 2020-07-07 武汉斗鱼网络科技有限公司 Method, system, server and storage medium for improving operation stability of client
CN111181992A (en) * 2020-01-03 2020-05-19 平安科技(深圳)有限公司 Communication method, device, equipment and storage medium of nodes and chain codes in block chain
CN111181992B (en) * 2020-01-03 2022-02-22 平安科技(深圳)有限公司 Communication method, device, equipment and storage medium of nodes and chain codes in block chain

Also Published As

Publication number Publication date
CN107665148B (en) 2020-06-16

Similar Documents

Publication Publication Date Title
US7818294B2 (en) Apparatus, system, and method for implementing an IMS SOAP gateway
US20120210243A1 (en) Web co-navigation
JP6164747B2 (en) Method for flow control in a collaborative environment and for reliable communication
WO2018032399A1 (en) Server and method having high concurrency capability
US9467483B2 (en) ABAP channels for event signaling
CN105939297B (en) A kind of TCP message recombination method and device
EP3837604A1 (en) In situ triggered function as a service within a service mesh
EP3054650A1 (en) Method, device and system for redirecting data service proxy
CN104135536A (en) Data interaction method of Web management system based on Json data protocols
US9094433B2 (en) Systems and methods for bearer independent protocol gateway optimization
CN107665148A (en) A kind of name pipeline Way of Process Communication based on Chromium
US11223686B2 (en) Transport channel via web socket for OData
US20180262560A1 (en) Method and system for transmitting communication data
US20170223147A1 (en) Communication method and system based on assembled communication protocol stack
US20160100015A1 (en) Systems and methods for resolving service initialization links in virtual desktop infrastructure environments
US10367785B2 (en) Software defined traffic modification system
EP3097662B1 (en) Methods, systems and computer readable media for testing network devices using simulated application traffic
CN105677688B (en) Page data loading method and system
CN103634338B (en) Method for modifying primary domain name of webpage online, data processing device and system
AU2018390863B2 (en) Computer system and method for extracting dynamic content from websites
CN105791239A (en) TCP intermediary processing method
US10514966B2 (en) Push-based event stream processing
CN105450515A (en) General IPv4/IPv6 data translation gateway for application layer protocols and method
CN110557428A (en) script interpretation type service agent method and system based on Kubernetes
CN102402850A (en) Centralized meter reading system of embedded Ethernet gateway and data transmission method thereof

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
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20200616