Using WSAEventSelect or WSAAsyncSelect
Applications can register their interest in receiving FD_QOS events by enabling asynchronous event notification with either the WSAAsyncSelect or WSAEventSelect function. Information about how to do so can be found in the Windows Sockets 2 documentation.
When registered for event notification using this mechanism, and an event notification occurs, an application can look up the status code (by using the WSAEnumNetworkEvents function, for example) and subsequently issue a WSAIoctl(SIO_GET_QOS) function call to retrieve the QOS structure associated with the event.
The associated QOS structure contains the current QOS parameters. Applications should inspect the QOS parameters to determine the extent of the changes associated with the event notification. There are a couple of issues to consider when working with FD_QOS events in this manner:
- You must issue the WSAIoctl(SIO_GET_QOS) to reenable the FD_QOS event.
- There may be multiple QOS status indications waiting for retrieval. Use the WSAIoctl(SIO_GET_QOS) function call in a loop until SOCKET_ERROR is returned.
Applications can also register their interest in FD_QOS events using overlapped WSAIoctl(SIO_GET_QOS), as explained in Using Overlapped WSAIoctl(SIO_GET_QOS).