passing a socket to a spawned process.

Marcos Dione mdione at grulic.org.ar
Mon Oct 11 20:25:06 CEST 2004


On Mon, Oct 11, 2004 at 10:23:27AM -0700, Mike M wrote:
> Is it possible?  In the parent process, I have a socket that binds,
> listens and then accepts new connections (which creates new sockets in
> the process).  I want to be able to pass some of these new sockets to
> a spawned process.  Is it possible, and if so how?

  just accept() before fork()'ing. the socket will be cloned. then close the
socket on the parent, unless needed.

-- 
(Not so) Random fortune:
(Really) Random fortune:
mdione at tempest:~$ cat /dev/random | uuencode random | head -n 3
begin 644 random
M=?:,8:@5MVVIM6>NAYQ6O at I&H86>.3(L"F7S>U'.9`2;%LEAR/E8M[*F=(MP
M5C>B3Y2F(X,`SW1UPAL*+OIV'EM/Z$_-15':B#<6I99_P,H%=$S6$H<&W-!;



More information about the Python-list mailing list