473,667 Members | 2,548 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Approaches of interprocess communication

Hi all,

Supposing you have two separate processes running on the same box,
what approach would you suggest to communicate between those two
processes.

Let me list the ones I know of:

* Sockets
Advantage: Supported per se in nearly every programming language
without even the need to install additional packages
Disadvantage: Lot's of code to write, and it's kind of silly to
communicate via TCP/IP if the processes run on the same machine.

* Webservices
Advantage: Relatively easy to use, can work across different
languages
Disadvantage: Even more overhead on the TCP/IP side that simple
sockets, as really bulky SOAP messages need to be passed around.

* CORBA -- similar to webservices but more complicated to code.

* Shared memory
I don't know much about this subject.

Supposing both processes are written in Python, is there any other way
to achieve this? To me, shared memory sound the most suited approach.
But as said, I am still fuzzy in this area. Where can I find more
information on this subject?

Feb 16 '07 #1
22 2662
En Fri, 16 Feb 2007 07:11:36 -0300, exhuma.twn <ex****@gmail.c omescribió:
Hi all,

Supposing you have two separate processes running on the same box,
what approach would you suggest to communicate between those two
processes.

Let me list the ones I know of:

* Sockets
Advantage: Supported per se in nearly every programming language
without even the need to install additional packages
Disadvantage: Lot's of code to write, and it's kind of silly to
communicate via TCP/IP if the processes run on the same machine.
Not so much code, really.
(And I would expect that making a connection to "localhost" actually does
*not* go down up to the network card hardware layer, but I don't know for
real if this is the case or not).
* Webservices
Advantage: Relatively easy to use, can work across different
languages
Disadvantage: Even more overhead on the TCP/IP side that simple
sockets, as really bulky SOAP messages need to be passed around.
You could use XMLRPC, wich is a lot simpler (but less powerful).
* CORBA -- similar to webservices but more complicated to code.
I would stay away as far as I could.
* Shared memory
I don't know much about this subject.
You forget the most basic one, stdio redirection. Easy, available on
almost any language, but limited to just a pair of processes.
You can add queues and messages.
Supposing both processes are written in Python, is there any other way
to achieve this? To me, shared memory sound the most suited approach.
But as said, I am still fuzzy in this area. Where can I find more
information on this subject?
Pyro appears to be a good alternative (altough I've never used it yet).

--
Gabriel Genellina

Feb 16 '07 #2
Supposing you have two separate processes running on the same box,
what approach would you suggest to communicate between those two
processes.

Let me list the ones I know of:

* Sockets
Advantage: Supported per se in nearly every programming language
without even the need to install additional packages
Disadvantage: Lot's of code to write, and it's kind of silly to
communicate via TCP/IP if the processes run on the same machine.

* Webservices
Advantage: Relatively easy to use, can work across different
languages
Disadvantage: Even more overhead on the TCP/IP side that simple
sockets, as really bulky SOAP messages need to be passed around.

* CORBA -- similar to webservices but more complicated to code.

* Shared memory
I don't know much about this subject.

Supposing both processes are written in Python, is there any other way
to achieve this? To me, shared memory sound the most suited approach.
But as said, I am still fuzzy in this area. Where can I find more
information on this subject?
Hi, if your requirements are sufficiently light then pylinda might be
an easy-to-use solution:

http://www-users.cs.york.ac.uk/~aw/pylinda/

A simple example is here:

http://www-users.cs.york.ac.uk/~aw/p.../beginner.html

HTH,
Daniel
Feb 16 '07 #3
"exhuma.twn " <ex****@gmail.c omwrites:
Supposing you have two separate processes running on the same box,
what approach would you suggest to communicate between those two
processes.

Let me list the ones I know of:

* Sockets
Advantage: Supported per se in nearly every programming language
without even the need to install additional packages
This would be my choice. But first, set up a well-defined *protocol*
(preferably based on text commands) for the two processes to use for
communication; don't have each of them being intricately aware of each
others' implementation.
Disadvantage: Lot's of code to write, and it's kind of silly to
communicate via TCP/IP if the processes run on the same machine.
You can cut down on the amount of code by using the standard library
"cmd" module to handle a command interface, hooking the stdin and
stdout of the commandline handler to the socket.

If you're already thinking about cooperating processes, you should
make them network-neutral anyway from the start.

Here's what _The Art of Unix Programming_ has to say on the topic of
text protocols:

<URL:http://www.catb.org/~esr/writings/taoup/html/ch05s01.html>

and IPC tactics for peer processes:

<URL:http://www.catb.org/~esr/writings/taoup/html/ch07s07.html>

--
\ "There are only two ways to live your life. One is as though |
`\ nothing is a miracle. The other is as if everything is." -- |
_o__) Albert Einstein |
Ben Finney

Feb 16 '07 #4
"Gabriel Genellina" <ga******@yahoo .com.arwrites:
(And I would expect that making a connection to "localhost" actually
does *not* go down up to the network card hardware layer, but I
don't know for real if this is the case or not).
It damned well better. That's the entire point of the loopback
interface: to get all the network layer code involved, but not to talk
on a physical network interface.

If a programmer decides on behalf of the user that "localhost" should
be treated specially, that programmer is making an error.

--
\ "If you can't beat them, arrange to have them beaten." -- |
`\ George Carlin |
_o__) |
Ben Finney

Feb 16 '07 #5
In article <11************ **********@m58g 2000cwm.googleg roups.com>,
exhuma.twn <ex****@gmail.c omwrote:
>Supposing you have two separate processes running on the same box,
what approach would you suggest to communicate between those two
processes.
[...]
>* Webservices
Advantage: Relatively easy to use, can work across different
languages
Disadvantage: Even more overhead on the TCP/IP side that simple
sockets, as really bulky SOAP messages need to be passed around.

* CORBA -- similar to webservices but more complicated to code.
Lots of people say that, but I don't think it's true. Obviously as the
maintainer of a CORBA implementation I'm biased, but take a look at
some examples of code that implement SOAP clients and servers and
compare it to similar CORBA code. Especially in Python, the SOAP code
tends to be incredibly verbose and complex, and the CORBA code really
small and simple.

My recommendation would be that for simple communications where
performance isn't important use XML-RPC; for more complex cases where
performance is a bit more important but you don't need anything except
Python, use Pyro; for cases where performance is particularly
important and/or you need cross-language communications, use CORBA.

Cheers,

Duncan.

--
-- Duncan Grisby --
-- du****@grisby.o rg --
-- http://www.grisby.org --

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDem
Feb 16 '07 #6
On Feb 16, 1:33 pm, Duncan Grisby <duncan-n...@grisby.org wrote:
In article <1171620696.577 982.283...@m58g 2000cwm.googleg roups.com>,

exhuma.twn <exh...@gmail.c omwrote:
Supposing you have two separate processes running on the same box,
what approach would you suggest to communicate between those two
processes.

[...]
* Webservices
Advantage: Relatively easy to use, can work across different
languages
Disadvantage: Even more overhead on the TCP/IP side that simple
sockets, as really bulky SOAP messages need to be passed around.
* CORBA -- similar to webservices but more complicated to code.

Lots of people say that, but I don't think it's true. Obviously as the
maintainer of a CORBA implementation I'm biased, but take a look at
some examples of code that implement SOAP clients and servers and
compare it to similar CORBA code. Especially in Python, the SOAP code
tends to be incredibly verbose and complex, and the CORBA code really
small and simple.

My recommendation would be that for simple communications where
performance isn't important use XML-RPC; for more complex cases where
performance is a bit more important but you don't need anything except
Python, use Pyro; for cases where performance is particularly
important and/or you need cross-language communications, use CORBA.
Maybe this line of mine was a bit too condensed ;) I fully agree with
you on what you say about CORBA. It's just that for most people IDL
looks a bit out of place. Especially because it resembles C. But once
you actually wrote a few projects using CORBA, you actually begin to
see it's elegance ;)

I find Webservices "easier" as you can (although it's not
recommendable) leave out the WSDL part. And some implementations
actually generate the WSDL for you. But it's true, comparing WSDL and
IDL I'd rather write some IDL than WSDL ;)

But, returning back to topic, I first want to thank you all for your
input. I appreciate all the ideas. Especially the idea of using the
"cmd" module for sockets. That sound's very intriguing and I will very
likely play around with that. But also PYRO seems quite useful.

About "Linda": Am I right that it looks very similar to "JavaSpaces "?
If yes, are there any funcdamental differences between those two?

Feb 16 '07 #7
Maybe this line of mine was a bit too condensed ;) I fully agree with
you on what you say about CORBA. It's just that for most people IDL
looks a bit out of place. Especially because it resembles C. But once
you actually wrote a few projects using CORBA, you actually begin to
see it's elegance ;)
It looks out of the place in comparison to what exactly? A WSDL-document?
You certainly me laugh hard on that....
I find Webservices "easier" as you can (although it's not
recommendable) leave out the WSDL part. And some implementations
actually generate the WSDL for you.
You can't leave WSDL out of SOAP, you can leave it out of XMLRPC. Which is
nice and easy, but lacks any contract whatsoever. Nothing I as a Pythoneer
care to much about, but some people bother.

And generating the WSDL works from what exactly? ah, Java-code for example,
using java2wsdl. Which has a striking resemblance to.... C. Funny....
But it's true, comparing WSDL and
IDL I'd rather write some IDL than WSDL ;)
So - you say that yourself, but still you previously claimed IDL looks
strange to the eye?

Diez
Feb 16 '07 #8
On 16 Feb, 14:16, "Diez B. Roggisch" <d...@nospam.we b.dewrote:
>
You can't leave WSDL out of SOAP
Yes you can, since they're two different things. What you probably
meant was that you can't leave WSDL out of "big architecture", W3C
standards-intensive Web services. Of course, RPC-style SOAP without
the contracts imposed by WSDL may remove some of the attractions for
some people (who really should consider CORBA, anyway), but then
there's always document-oriented SOAP, although if you don't want the
baggage associated with routing and other things, plain XML messaging
would be easier. And there's always XMPP if you want stuff like
routing and a standard that isn't undergoing apparently continuous
change.

Paul

Feb 16 '07 #9
Paul Boddie wrote:
On 16 Feb, 14:16, "Diez B. Roggisch" <d...@nospam.we b.dewrote:
>>
You can't leave WSDL out of SOAP

Yes you can, since they're two different things. What you probably
meant was that you can't leave WSDL out of "big architecture", W3C
standards-intensive Web services. Of course, RPC-style SOAP without
the contracts imposed by WSDL may remove some of the attractions for
some people (who really should consider CORBA, anyway), but then
there's always document-oriented SOAP, although if you don't want the
baggage associated with routing and other things, plain XML messaging
would be easier. And there's always XMPP if you want stuff like
routing and a standard that isn't undergoing apparently continuous
change.
Didn't know that. Yet I presume it is pretty awful to manually decompose and
compose the method invocations and parameter sets.

I've got no idea what document-orientied SOAP means either. Is that just
pushing XML-files over a protocol?

Diez
Feb 16 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
442
by: Daniel | last post by:
I search for a good way to communicate between processes. I have a main application(might be more instances) and an tool that should exchange information such as which user is logged in into the application and more. Now i'm doing it by sending API WM_COPYDATA messages with SendMessage. Our users are identified by a Guid and getting the app user by sending four WM_COPYDATA with kind a "GiveMeUserGuidPart0of4" and putting to gether the 4...
4
2160
by: Charles Packer | last post by:
I need to do the following simple interprocess communication (IPC) among these processes that are all on the same box: -- A daemon waits for "I'm here" announcements from multiple clients -- One or more clients send an "I'm here" to the daemon upon command via the client's GUI (Each client's GUI is viewed by a different human user) The daemon retransmits "X is here" to all clients when it receives any "I'm here". I read some tutorials...
3
4794
by: James Aguilar | last post by:
Oh wise readers of comp.lang.python, Lend a newbie your ears. I have read several old articles from this group about memory mapping and interprocess communication and have Googled the sh** out of the internet, but have not found sufficient to answer my questions. Suppose that I am writing a ray tracer in Python. Well, perhaps not a ray tracer. Suppose that I am writing a ray tracer that has to update sixty times a second (Ignore...
7
2051
by: Michael Butscher | last post by:
Hi, this is not really Python-specific but I need it for Python. I'm wanting a method for interprocess communication which is OS- independent (sockets would be the normal way to go), but which works if multiple users use the machine at the same time so that one user has no access to the communication of programs of another user. Normally any user could connect to an open socket on a machine
4
2076
by: batista | last post by:
Hello all, I need suggestions and possibly solutions to the problem stated below: I have an application written purely in .NET ( Windows Form Application) and another application that is supposed to be written in MFC(Visual C++) or Win32 GUI Application. The problem is to communicate data between the two applications. for example,
0
1486
by: Murali | last post by:
Hi Python Gurus, I am writing a GUI app (on linux) using pygtk which would launch some external applications and display their stdout and stderr inside the output window of my application synchronously. I am using the subprocess module's Popen to launch the external programs and to capture their stdout and stderr. The problem is that, for some external programs that I launch inside my interface, I am not able to capture and display the...
2
1786
by: Murali | last post by:
Hi Python Gurus, I am writing a GUI app (on linux) using pygtk which would launch some external applications and display their stdout and stderr inside the output window of my application synchronously. I am using the subprocess module's Popen to launch the external programs and to capture their stdout and stderr. The problem is that, for some external programs that I launch inside my interface, I am not able to capture and display the...
3
4085
by: madankarmukta | last post by:
Hi all, I am very new to Implementation of the Interprocess communication.I am trying to implement the concept in c++.I created the pipe using Createnamedpipe() function ,connecting to that pipe using ConnectNamedPipe() function and then reading the file created on the file at one end. But I am bit curious about the how the process/user at the other end of the pipe will communicate with the my terminal.How the things goes in the...
0
8365
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8883
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8788
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8563
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7390
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6203
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4200
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2776
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.