portable way of sending notifying a process

News123 news1234 at free.fr
Mon May 30 05:18:30 EDT 2011


Thanks for all your feedback.


Well, I'll play a little and go either for a wrapper around
ways to detecth a file change or for a tiny socket solution.

Thanks again.


On 05/30/2011 04:03 AM, Chris Angelico wrote:
> On Mon, May 30, 2011 at 11:44 AM, Chris Torek <nospam at torek.net> wrote:
>>> What would be a light weight portable way, that one process can tell
>>> another to do something?
>>>
>>> The main requirement would be to have no CPU impact while waiting (thus
>>> no polling)
>>
>> Your best bet here is probably to use sockets.  Both systems have
>> ways to create service sockets and to connect to a socket as a
>> client.
> 
> Further to this: If your two processes are going to start up, then run
> concurrently for some time, and during that time alert each other (or
> one alerts the other) frequently, a socket is an excellent choice. Use
> a TCP socket on Windows, and either a TCP socket or a Unix socket on
> Linux (I'd just use TCP on both for simplicity, but Unix sockets are
> faster), and simply write a byte to it whenever you want to alert the
> other side. You can largely guarantee that no other process can
> accidentally or maliciously wake you, as long as you have some kind of
> one-off handshake on connection - even something really simple like
> sending a random nonce, having the other end send hash(nonce +
> password), and compare.
> 
> Chris Angelico
> Huge fan of TCP sockets (hello MUDs!)




More information about the Python-list mailing list