how to pass a python socket to a .dll?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • inhahe

    how to pass a python socket to a .dll?

    i'm trying to make a .dll that will let me use WSAPoll, which is a windows
    sockets function, to mimic select.poll on a windows box. i cbb learning
    python extensions, so i'm just going to use ctypes with a dll, so I hope
    that it doesn't bring up a big performance issue. anyway, the problem is
    that I want to use Python-created sockets with it, but WSAPoll requires
    winsock2.h SOCKET objects.

    so unless someone can tell me how to create/reference a windows socket
    object using the winsock2 lib from just a file/socket descriptor (being that
    this isn't a windows programming forum), i'm just asking how I could gain
    access to the actual Windows socket associated with a Python socket that
    Python for Windows has to store somewhere. even if I have to modify
    socketmodule.c.

    btw, i don't know much about this stuff, i hardly ever even program in c++,
    so i hope anybody's not too cryptic :P






  • Gabriel Genellina

    #2
    Re: how to pass a python socket to a .dll?

    En Tue, 13 May 2008 12:48:26 -0300, inhahe <inhahe@gmail.c omescribió:
    i'm trying to make a .dll that will let me use WSAPoll, which is a
    windows
    sockets function, to mimic select.poll on a windows box. i cbb learning
    python extensions, so i'm just going to use ctypes with a dll, so I hope
    that it doesn't bring up a big performance issue. anyway, the problem
    is
    that I want to use Python-created sockets with it, but WSAPoll requires
    winsock2.h SOCKET objects.
    Use the fileno() method to get the SOCKET handle.
    If you're going to use ctypes anyway, why bother to write a DLL? Just
    declare the required structures and functions using ctypes. Good luck!

    --
    Gabriel Genellina

    Comment

    Working...