Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function is called to free the handle after previous calls to WSALookupServiceBegin (Windows Sockets)and WSALookupServiceNext (Windows Sockets).

Syntax

INT WSALookupServiceEnd(
  HANDLE 
hLookup
);

Parameters

hLookup

[in] Handle previously obtained by calling the WSALookupServiceBegin (Windows Sockets)function.

Return Value

If the operation was successful, the return value is zero. If an error occurs, the value SOCKET_ERROR is returned, and a specific error number can be retrieved by calling the WSAGetLastErrorfunction. The following table shows a list of possible error codes.

Error code Description

WSA_INVALID_HANDLE

The handle is not valid.

WSANOTINITIALIZED

Ws2.dll has not been initialized. The application must first call the WSAStartupfunction before calling any Windows Sockets functions.

WSA NOT ENOUGH MEMORY

There was insufficient memory to perform the operation.

Remarks

If you call this function from another thread while an existing WSALookupServiceNext (Windows Sockets)is blocked, the end call will have the same effect as a cancel and will cause the WSALookupServiceNextcall to return immediately.

Notes for Bluetooth

Bluetooth clients use WSALookupServiceBegin (Windows Sockets), WSALookupServiceNext (Windows Sockets), and WSALookupServiceEndto discover the existence of a particular service on the Bluetooth RFCOMM server. Queries can be done for local and remote addresses, although for RFCOMM a client can connect only to remote addresses.

Requirements

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

See Also