On Mon, Aug 22, 2011 at 04:45:24PM -0400, Andrew Stitcher wrote:
> > 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.

SOCKET is the first argument used in the recv() function [1] which can
be used to do just that (use MSG_WAITALL with a buffer size of 1 should
block until the EventNotifier pushes a byte into the socket if none is
there). And on Vista and later SOCKET is an element of the struct passed
into WSAPoll().

Granted, looking on the MSDN page there's a two-year old report that, on
WinXP, MSG_WAITALL seems to not be supported. I'll check and ensure that
it's working on XP.

[1] - http://msdn.microsoft.com/en-us/library/ms740121%28v=VS.85%29.aspx

-- 
Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc.
Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/

Attachment: pgpB2Q7XG2BWD.pgp
Description: PGP signature

Reply via email to