Process intercommunication

Graham Dumpleton grahamd at dscpl.com.au
Mon Nov 5 18:38:23 EST 2001


Mikael Olofsson <mikael at isy.liu.se> wrote in message news:<mailman.1004954826.23648.python-list at python.org>...
> Hi all!
> 
> Here is what I want to do, in short: I want two processes to be able
> communicate with each other. Naturally, these processes are supposed 
> to be executed Python code. And we are on Solaris.
> 
> More precisely:
> 
> Process A is supposed to be running all the time, while process B will 
> only live for a short period of time. Both processes are supposed to 
> live on the same machine. After collecting some data, B needs to 
> communicate that data to A and A is supposed to acknowledge to B that 
> the received data is OK. B is therefore supposed to identify A, and set 
> up a two-way communication link to A (with A's help, I suppose). After 
> the necessary comunication has taken place, the communication link is 
> supposed to be shut down, and B will soon die. B is only supposed to 
> know under what name A is running.

Depending on your requirements, you might consider an XML-RPC based solution.
There are a number of toolkis available for Python which support XML-RPC and
by using such an approach you need not have to worry about writing any
significant code to respond to socket requests nor to handling the marshalling
or unmarshalling of data as the toolkits do this for you.

For a complete example of a simple XML-RPC based system have a look at:

  http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81612

If you search around on the same site you should find other XML-RPC examples
using other server side toolkits as well.



More information about the Python-list mailing list