1

I wanted to use asynchronous socket operations with python using the Winsock WSAEventSelect function and the like. But there doesn't seem to be a way to call the winsock api functions from python. Am I missing something?

Why aren't they available, even as a module (like http://sourceforge.net/projects/pywin32/ for a lot of windows api functions)? Is there any other reason than "Nobody seemed to need it enough to implement it?"

BubuIIC
  • 380
  • 3
  • 15
  • WinSock is Windows's implementation of Berkley sockets, the UNIX standard. The standard Python implementation of `select` should do what you're looking for. – Linuxios Mar 21 '13 at 15:30
  • I'm sure you have a particular reason for wanting to use platform specific APIs, but there are some nice abstractions such as [Twisted](http://twistedmatrix.com/trac/) for this kind of thing. – James M Mar 21 '13 at 15:30
  • @Linuxios Nope. Although a Berkeley-style socket API is provided, it's just a wrapper over the real Winsock2 (and it's a good deal less powerful on Windows, where Berkeley sockets can't be combined with nice things like epoll and kqueue.) – James M Mar 21 '13 at 15:31
  • @Linuxios `select` is not really what I want to do, because it is either blocking or busy waiting/looping until socket is available. Under linux I wanted to use the `O_ASYNC` flag for the socket and then handle `SIGIO` to get true asynch behavior. The same can be achieved (I think) under windows with the `WSAEventSelect`, you then get notified by win32 events. – BubuIIC Mar 21 '13 at 15:37
  • @JamesMcLaughlin The whole project is more or less an exercise in socket programming and I wanted to know what I can and can't do on different platforms. So low-level stuff is what I want to do right now. – BubuIIC Mar 21 '13 at 15:41

0 Answers0