Slightly OT: detecting the socket type of a descriptor

Discussion in 'Python' started by Heiko Wundram, Jan 4, 2006.

  1. 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.
     
    Heiko Wundram, Jan 4, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Patrick LeBoutillier

    Read/Write IO on socket file descriptor?

    Patrick LeBoutillier, Jul 19, 2003, in forum: Perl
    Replies:
    0
    Views:
    3,070
    Patrick LeBoutillier
    Jul 19, 2003
  2. Rajarshi Guha
    Replies:
    0
    Views:
    360
    Rajarshi Guha
    Apr 7, 2004
  3. hg
    Replies:
    1
    Views:
    5,323
  4. mbm

    [socket] test socket descriptor state

    mbm, Sep 27, 2007, in forum: C Programming
    Replies:
    2
    Views:
    432
    CBFalconer
    Sep 27, 2007
  5. jungleman
    Replies:
    6
    Views:
    1,720
    Jorgen Grahn
    Nov 8, 2011
Loading...

Share This Page