I was trying to write an asyncronous TCP server for win32 using
WSAEventSelect (which lives if win32file). Such events require
WaitForMultipleObjects (which lives if win32event) and
WSAEnumNetworkEvents WHICH IS NOT EXPOSED. This makes WSAEventSelect
useless. Does somebody know how to add the WSAEnumNetworkEvents and
WSANetwotkEvents structure win32file?
Maybe I'm missing something?
You could both build the structures and call the functions in ctypes (http://starship.python.net/crew/theller/ctypes/)
[untested code follows]
from ctypes import * class WSANETWORKEVENTS(Structure): _fields_ = [('lNetworkEvents', c_long), ('iErrorCode', c_int * 10) # 10 = FD_MAX_EVENTS ]
You'd access the API via windll.ws2_32.WSAEnumNetworkEvents, e.g.
networkEvents = WSANETWORKEVENTS() i = windll.ws2_32.WSAEnumNetworkEvents(s, hEventObject, byref(networkEvents)) if i != 0: # Handle an error
HTH, Dave -- http://mail.python.org/mailman/listinfo/python-list