WsCloseListener function (webservices.h)

Causes the specified listener to stop listening.

Syntax

HRESULT WsCloseListener(
  [in]           WS_LISTENER            *listener,
  [in, optional] const WS_ASYNC_CONTEXT *asyncContext,
  [in, optional] WS_ERROR               *error
);

Parameters

[in] listener

Pointer to a WS_LISTENER structure representing the listener to close.

[in, optional] asyncContext

Pointer to a WS_ASYNC_CONTEXT structure containing information for invoking the function asynchronously. Pass NULL to invoke the function synchronously.

[in, optional] error

Pointer to a WS_ERROR structure that receives additional error information if the function fails.

Return value

If the function succeeds, it returns NO_ERROR; otherwise, it returns an HRESULT error code.

Return code Description
WS_S_ASYNC
The asynchronous operation is still pending.
WS_E_OPERATION_ABORTED
The close was aborted by a call to WsAbortListener as the listener was closing.
WS_E_INVALID_OPERATION
The listener was in an inappropriate state.
WS_E_OPERATION_TIMED_OUT
The operation did not complete within the time allotted.
E_INVALIDARG
One or more arguments are invalid.
Other Errors
This function may return other errors not listed above.

Remarks

After the listener is closed, the listener can safely be released.

This operation is allowed for listener in the WS_LISTENER_STATE_OPEN or WS_LISTENER_STATE_FAULTED state. (For listener states, see the WS_LISTENER_STATE enumeration.)

When a listener is closed, any pending attempts to accept a channel with the WsAcceptChannel method are aborted. However, WsCloseListener waits for any pending I/O to complete before proceeding with the closing process.

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header webservices.h
Library WebServices.lib
DLL WebServices.dll