Share via


Service Query

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

A name service query involves a series of calls: NSPLookupServiceBegin, followed by one or more calls to NSPLookupServiceNext and ending with a call to NSPLookupServiceEnd. NSPLookupServiceBegin takes a WSAQUERYSET structure as input in order to define the query parameters along with a set of flags to provide additional control over the search operation. It returns a query handle that is used in the subsequent calls to NSPLookupServiceNext and NSPLookupServiceEnd.

The namespace SPI client invokes NSPLookupServiceNext to obtain query results, with results supplied in a client-supplied WSAQUERYSET buffer. The client continues to call NSPLookupServiceNext until the error code WSA_E_NO_MORE is returned indicating that all results have been retrieved. The search is then terminated by a call to NSPLookupServiceEnd. The NSPLookupServiceEnd function can also be used to cancel a currently pending NSPLookupServiceNext when called from another thread.

In Winsock, conflicting error codes are defined for WSAENOMORE (10102) and WSA_E_NO_MORE (10110). The error code WSAENOMORE will be removed in a future version and only WSA_E_NO_MORE will remain. Namespace providers should switch to using the WSA_E_NO_MORE error code as soon as possible to maintain compatibility with the widest possible range of applications.

See Also

Concepts

Namespace Provider Installation