WSALookupServiceNext

The Windows Sockets WSALookupServiceNext function is called after obtaining a handle from a previous call to WSALookupServiceBegin in order to retrieve the requested service information.

The provider will pass back a WSAQUERYSET structure in the lpqsResults buffer. The client should continue to call this function until it returns WSA_E_NOMORE, indicating that all of WSAQUERYSET has been returned.

INT WSALookupServiceNext (

HANDLE hLookup,

DWORD dwControlFlags,

LPDWORD lpdwBufferLength,

LPWSAQUERYSET lpqsResults

);

Parameters

hLookup

[in] Handle returned from the previous call to WSALookupServiceBegin.

dwControlFlags

[in] Flags to control the next operation. This is currently used to indicate to the provider what to do if the result set is too big for the buffer. If on the previous call to WSALookupServiceNext the result set was too large for the buffer, the application can choose to do one of two things on this call. First, it can choose to pass a bigger buffer and try again. Second, if it cannot or is unwilling to allocate a larger buffer, it can pass LUP_FLUSHPREVIOUS to tell the provider to throw away the last result set, which was too large, and move on to the next set for this call.

lpdwBufferLength

[in/out] On input, the number of bytes contained in the buffer pointed to by lpresResults. On output, if the function fails and the error is WSAEFAULT, then it contains the minimum number of bytes to pass for the lpqsResults to retrieve the record.

lpqsResults

[out] A pointer to a block of memory, which will contain one result set in a WSAQUERYSET structure on return.

Query Results

The following table describes how the query results are represented in the WSAQUERYSET structure.

WSAQUERYSET Field Name
Result Interpretation
dwSize
Will be set to sizeof(WSAQUERYSET). This is used as a versioning mechanism.
dwOuputFlags
RESULT_IS_ALIAS flag indicates this is an alias result.
lpszServiceInstanceName
Referenced string contains service name.
lpServiceClassId
The GUID corresponding to the service class.
lpVersion
References version number of the particular service instance.
lpszComment
Optional comment string supplied by service instance.
dwNameSpace
Name space in which the service instance was found.
lpNSProviderId
Identifies the specific name space provider that supplied this query result.
lpszContext
Specifies the context point in a hierarchical name space at which the service is located.
dwNumberOfProtocols
Undefined for results.
lpafpProtocols
Undefined for results, all needed protocol information is in the CSADDR_INFO structures.
lpszQueryString
Undefined for results.
dwNumberOfCsAddrs
Indicates the number of elements in the array of CSADDR_INFO structures.
lpcsaBuffer
A pointer to an array of CSADDR_INFO structures, with one complete transport address contained within each element.
lpBlob
(Optional) This is a pointer to a provider-specific entity.

Return Values

The return value is zero if the operation was successful. Otherwise, the value SOCKET_ERROR is returned, and a specific error number may be retrieved by calling WSAGetLastError.

Error Codes

WSA_E_NO_MORE
There is no more data available.
WSA_E_CANCELLED
A call to WSALookupServiceEnd was made while this call was still processing. The call has been canceled. The data in the lpqsResults buffer is undefined.
WSAEFAULT
The lpqsResults buffer was too small to contain a WSAQUERYSET set.
WSA_INVALID_HANDLE
The specified Lookup handle is invalid.
WSANOTINITIALIZED
The Windows Sockets 2 DLL has not been initialized. The application must first call WSAStartup before calling any Windows Sockets functions.
WSANO_DATA
The name was ound in the database, but no data matching the given restrictions was located.
WSASERVICE_NOT_FOUND
No such service is known. The service cannot be found in the specified name space.

See Also

WSALookupServiceBegin
and WSALookupServiceEnd

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database