Slightly OT: detecting the socket type of a descriptor

H

Heiko Wundram

Hi all!

I'm currently in the process of implementing SCM_RIGHTS support for Python
in the socket module, and I'm stuck at wrapping socket descriptors in an
appropriate socket object.

The problem boils down to the fact that I can test for the type of a file
descriptor being a socket, but after I know that it's a socket I can't seem
to test for the address and/or protocol family, which is kinda important to
create the appropriate Python socket object. (for files, creating an
appropriate python file object is easier, as the file open type can be
gotten from the stat structure)

Anyway, is there a way to reliably detect this? Thanks for any insight!

btw. if you're interested in the socket module's extension, have a look at

http://svn.asta.mh-hannover.de/asta/Python/trunk/Modules/socketmodule.c

for the complete bowels of the enhanced _socket module implementation,
especially the recvmsg() function.

--- Heiko.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top