Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #6609

Re: portable way of sending notifying a process

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'socket': 0.04; 'concurrently': 0.07; 'subject:process': 0.07; 'accidentally': 0.09; 'sockets': 0.09; 'this:': 0.10; 'linux': 0.11; 'am,': 0.14; 'wrote:': 0.14; "(i'd": 0.16; 'angelico': 0.16; 'compare.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'handshake': 0.16; 'other)': 0.16; 'side.': 0.16; 'simplicity,': 0.16; 'subject:sending': 0.16; 'mon,': 0.17; 'header:In-Reply- To:1': 0.21; 'received:209.85.210.174': 0.23; 'received:mail- iy0-f174.google.com': 0.23; 'weight': 0.23; '(or': 0.24; 'byte': 0.25; 'message-id:@mail.gmail.com': 0.28; 'random': 0.28; 'to:addr :python-list': 0.33; 'chris': 0.34; 'light': 0.34; 'probably': 0.36; 'connection': 0.37; 'received:google.com': 0.37; 'something': 0.37; 'received:209.85': 0.37; 'ways': 0.37; 'two': 0.37; 'run': 0.38; 'but': 0.38; 'subject:: ': 0.38; 'some': 0.38; 'received:209': 0.39; 'either': 0.39; 'to:addr:python.org': 0.39; 'unix': 0.40; 'really': 0.40; 'simply': 0.60; 'kind': 0.60; 'best': 0.60; 'your': 0.60; 'waiting': 0.61; 'huge': 0.62; 'alert': 0.65; 'further': 0.65; 'here': 0.66; 'fan': 0.66; 'guarantee': 0.72; '30,': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=9Dv9CxotLUtxjUIzKsg1QuliQ3oLMEH59VIbRY8Mnfg=; b=jJ7119kJ4DrGem48dl+ZJJnggaka59S5SAoB7mVmjDXFqGrJ39xZYLezuWFumv1Ks8 c2MtDDqyiLDkCJT5fwq+xfBMPziBi+TxiimQOTEPaLwTDqApn4b0mL/NfpX/fa0I1fIW oJ3z8S/t2pF1IFamy50wCoZloELX1KokIwG/s=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=e/oby8MSvZ1jHow/a6K2UeVe8aF1pzhYXCYPCMtPA7A4HZ09UwSSl9wdL7ewjpKfYG o005ydWrr+85DnB2DJCp/aRNGEunXxeDcnsYz6xcGqxxbpW29vk1eM9p3pwnu/pwyo7c wgrrjVa96jzLFdUfBsTm85pG/HSHJc/1Au768=
MIME-Version 1.0
In-Reply-To <irusph1cdd@news3.newsguy.com>
References <4de183e7$0$26108$426a74cc@news.free.fr> <irusph1cdd@news3.newsguy.com>
Date Mon, 30 May 2011 12:03:21 +1000
Subject Re: portable way of sending notifying a process
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2247.1306721004.9059.python-list@python.org> (permalink)
Lines 25
NNTP-Posting-Host 82.94.164.166
X-Trace 1306721005 news.xs4all.nl 49176 [::ffff:82.94.164.166]:48654
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:6609

Show key headers only | View raw


On Mon, May 30, 2011 at 11:44 AM, Chris Torek <nospam@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!)

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

portable way of sending notifying a  process News123 <news1234@free.fr> - 2011-05-29 01:23 +0200
  Re: portable way of sending notifying a  process Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-05-29 00:09 -0700
  Re: portable way of sending notifying a  process Chris Torek <nospam@torek.net> - 2011-05-30 01:44 +0000
    Re: portable way of sending notifying a process Chris Angelico <rosuav@gmail.com> - 2011-05-30 12:03 +1000
      Re: portable way of sending notifying a process News123 <news1234@free.fr> - 2011-05-30 11:18 +0200

csiph-web