Receiving Notifications by Using WSANSPIoctl (Windows CE 5.0)
PNRP uses the WSANSPIoctl function to receive notifications about changes to the following:
- A network cloud list
- Availability of results of a name resolution request
The first call to WSALookupServiceBegin defines the type of information that a client is notified about. A client can be notified with a Windows message, a completion routine, a handle to a WSAEVENT object, or a port. For more information about options and setting the lpCompletion parameter, see WSANSPIoctl.
The WSALookupServiceNext function blocks even if WSANSPIoctl is called. Before calling WSALookupServiceNext, an application must wait until it receives a notification — if blocking is an issue. To continue receiving notifications after a call to WSALookupServiceNext, an application must call WSANSPIoctl again.
The following table shows WSANSPIoctl parameter values for with a description of the purpose for each.
|hLookup||Specifies the handle that WSALookupServiceBegin returns.|
|dwControlCode||Must be SIO_NSP_NOTIFY_CHANGE.|
|lpvInBuffer||Must be NULL.|
|cbInBuffer||Must be zero (0).|
|lpvOutBuffer||Must be NULL.|
|cbOutBuffer||Must be zero (0).|
|lpcbBytesReturned||Must be NULL.|
|lpCompletion||Specifies either NULL or a pointer to a WSACOMPLETION structure.|
After a notification is received, call WSALookupServiceNext one time to obtain the results. To end a search, call WSALookupServiceEnd.
A client can be notified any time that a name resolution entry is added. The client then calls WSALookupServiceNext to obtain the resolution data. If the client does not use this technique, a call to WSALookupServiceNext can be blocked until the specified timeout occurs.
Cloud List Notifications
A client can be notified any time there is a change to a set of clouds.
The WSALookupServiceNext function returns WSA_E_NO_MORE as a set delimiter. The client application must enumerate existing clouds until this message is returned, and then use a notification scheme to retrieve subsequent changes as they occur. A client application can also call WSALookupServiceNext, but the call is blocked until a change occurs.
The WSALookupServiceNext function returns a cloud in a WSAQUERYSET structure. The following table shows the possible flags returned in the dwOutputFlags member.
|RESULT_IS_ADDED||The cloud that is returned is added.|
|RESULT_IS_CHANGED||The cloud that is returned is changed.|
|RESULT_IS_DELETED||The cloud that is returned is deleted and is not valid.|
Send Feedback on this topic to the authors