Sockets accept() in child processes

Dan Stromberg drsalists at gmail.com
Thu Apr 12 13:10:47 EDT 2012


I wonder if this'll do what you need:
https://trac.calendarserver.org/browser/CalendarServer/trunk/twext/python/sendfd.py

On Thu, Apr 12, 2012 at 2:31 AM, Thibaut DIRLIK <merwin.irc at gmail.com>wrote:

> Hi,
>
> I'm writing a multiprocess server with Python 3.2 and the multiprocessing
> module. Here is my current implementation :
>
> - Main process: select() on a list of server sockets (different ips of the
> host, ssl or not, etc)
> - Children process : When they get a signal (in fact, a message in a
> pipe), they will accept() the server socket
>
> The problem is that after select() returns, I can accept() in the main
> process, but in a children process I got a EAGAIN error.
> The sockets are non-blocking. It seems that accept() can only be called in
> the same process that the one which selected().
>
> This is a problem because I wanted to "decide" which process I should ask
> to take the connection
> to do some basic load-balacing based on current number of connected client
> in each process.
>
> Could someone help me or propose other implementations ?
>
> Thank you,
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120412/aa8e7458/attachment-0001.html>


More information about the Python-list mailing list