Passing file descriptors in Python?
nascheme at enme.ucalgary.ca
nascheme at enme.ucalgary.ca
Fri Oct 1 22:30:34 EDT 1999
On Sat, Oct 02, 1999 at 02:12:28AM +0000, Dan wrote:
> Has anyone attempted to pass file descriptors from one process to
> another under using Python on Linux? I want to build a little web
> server that accepts connections and hands them off to child processes
> exactly like Apache does.
I don't know too much about how apache works but fork works just
fine with Python:
>>> import os
>>> f = open('foo', 'w')
>>> if os.fork() == 0:
... print 'child', f.fileno()
... else:
... print 'parent', f.fileno()
...
parent 3
child 3
More information about the Python-list
mailing list