[python-win32] WSAAsyncSelect

Tim Roberts timr at probo.com
Wed Jan 5 23:35:32 CET 2011


david.briant at ubs.com wrote:
>
> I’m looking for a little help on using WSAAsyncSelect via ctypes.I
> imagine this has been asked before but I couldn’t figure out how to
> search the archives (and trawling through them randomly didn’t really
> help).
>
> ...Would it be something likethe following?
>
> winsock = ctypes.windll.ws2_32
>
> WM_MY_SOCKET_MESSAGE= WM_USER + 1
>
>>
> s =12345
>
> hWnd = 1234
>
> wMsg = WM_MY_SOCKET_MESSAGE
>
> lEvent =FD_READ|FD_WRITE|FD_ACCEPT|FD_CONNECT|FD_CLOSE
>
> socketErrorOrZero = winsock.WSAAsyncSelect(s, hWnd, wMsg, lEvent)
>

Yes, indeed.  I think that sock.socket.fileno should get you the socket
handle for the first parameter.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list