Sorry for replying to myself, but sometimes curiosity just gets the better of me...
On Mon, 2011-08-22 at 16:45 -0400, Andrew Stitcher wrote: > On Mon, 2011-08-22 at 16:37 -0400, Darryl L. Pierce wrote: > > On Mon, Aug 22, 2011 at 12:46:43PM -0500, Steve Huston wrote: > > > FWIW, WSAPoll is not available on XP; it was introduced at Vista. > > > > But the SOCKET type, which is used by WSAPoll as well as pre-existing > > functions to retrieve data from a socket, does. And since what we're > > looking for is what the appropriate return type on Windows should be, > > I'm planning to do: > > > > #ifdef WIN32 > > #include <winsock2.h> > > typedef SOCKET QMF_IO_HANDLE; > > #else > > typedef int QMF_IO_HANDLE; > > #endif > > Can you use the winsock SOCKET type as a general windows HANDLE? ie is > it valid as an input to WaitForMultipleObjects()? If you can then SOCKET > is good enough for integration into an applications main loop if not > then it isn't sufficient. After some googling it seems that Winsock SOCKETs are really not equivalent in the way you want to Unix file descriptors and can't in themselves be used in the same sort of places. But you can create a windows HANDLE from a SOCKET by using WSAEventSelect() but you need to know what event (read/write/etc.) you want the HANDLE triggered for. In any event the simple #ifdef scheme above is not very useful in the real world. Andrew --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[email protected]
