Passing file descriptors in Python?

Guido van Rossum guido at cnri.reston.va.us
Sat Oct 2 20:51:50 EDT 1999


puter_programmer at yahoo.com (Dan) writes:

> I'm currently needing the module for a project that will run on a
> Linux machine and unfortunately Linux does appear to support the
> System-V approach.  There is no I_SENDFD or I_RECVFD in the ioctl()
> man page.  I have found two example code URLs so far and both use the
> socketpair() call which isn't in the Python socket module.  So I'm
> assuming my only option is to write a C module to do this?  If I can
> get it done it might be a nice compliment to my only other C module
> appropriately named hello_world. ;-)

My guess is that those examples use socketpair() because it's
convenient, not because it's necessary.  I would guess that creating a
server AF_UNIX socket in the parent and a client AF_UNIX socket in the
child, connecting the latter to the former, would allow you to do the
same thing.  You might even be able to do this between unrelated
processes.  Of course, this is pure speculation...

--Guido van Rossum (home page: http://www.python.org/~guido/)




More information about the Python-list mailing list