how to pass a python socket to a .dll?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Wed May 14 00:56:07 EDT 2008


En Tue, 13 May 2008 12:48:26 -0300, inhahe <inhahe at gmail.com> escribió:

> 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




More information about the Python-list mailing list