WSAQUERYSET (Windows Sockets)

A version of this page is also available for

Windows Embedded CE 6.0 R3


This structure provides relevant information about a given service, including service class ID, service name, applicable name-space identifier and protocol information, as well as a set of transport addresses at which the service listens.


typedef struct _WSAQuerySet {
  DWORD dwSize;
  LPTSTR lpszServiceInstanceName;
  LPGUID lpServiceClassId;
  LPTSTR lpszComment;
  DWORD dwNameSpace;
  LPGUID lpNSProviderId;
  LPTSTR lpszContext;
  DWORD dwNumberOfProtocols;
  LPAFPROTOCOLS lpafpProtocols;
  LPTSTR lpszQueryString;
  DWORD dwNumberOfCsAddrs;
  LPCSADDR_INFO lpcsaBuffer;
  DWORD dwOutputFlags;
  LPBLOB lpBlob;


  • dwSize
    Must be set to sizeof(WSAQUERYSET). This is a versioning mechanism.
  • dwOutputFlags
    Ignored for queries.
  • lpszServiceInstanceName
    (Optional) Referenced string contains service name. The semantics for using wildcards within the string are not defined, but can be supported by certain name space providers.
  • lpServiceClassId
    (Required) The GUID corresponding to the service class.
  • lpVersion
    (Optional) References desired version number and provides version comparison semantics (that is, version must match exactly, or version must be not less than the value supplied).
  • lpszComment
    Ignored for queries.
  • dwNameSpace
    Identifier of a single name space in which to constrain the search, or NS_ALL to include all name spaces.
  • lpNSProviderId
    (Optional) References the GUID of a specific name-space provider, and limits the query to this provider only.
  • lpszContext
    (Optional) Specifies the starting point of the query in a hierarchical name space.
  • dwNumberOfProtocols
    Size of the protocol constraint array, can be zero.
  • lpafpProtocols
    (Optional) References an array of AFPROTOCOLS structure. Only services that utilize these protocols will be returned.
  • lpszQueryString
    (Optional)Some name spaces (such as Whois++) support enriched SQL-like queries that are contained in a simple text string. This parameter is used to specify that string.
  • dwNumberOfCsAddrs
    Ignored for queries.
  • lpcsaBuffer
    Ignored for queries.
  • lpBlob
    (Optional)This is a pointer to a provider-specific entity.


In most instances, applications interested in only a particular transport protocol should constrain their query by address family and protocol rather than by name space. This would allow an application that needs to locate a TCP/IP service, for example, to have its query processed by all available name spaces such as the local hosts file, DNS, and NIS.


Header winsock2.h
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also


WSASetService (Windows Sockets)
WSALookupServiceBegin (Windows Sockets)
WSALookupServiceNext (Windows Sockets)