PFN_WSK_DISCONNECT_EVENT callback function (wsk.h)

The WskDisconnectEvent event callback function notifies a WSK application that a connection on a connection-oriented socket has been disconnected by the remote application.

Syntax

PFN_WSK_DISCONNECT_EVENT PfnWskDisconnectEvent;

NTSTATUS PfnWskDisconnectEvent(
  [in, optional] PVOID SocketContext,
  [in]           ULONG Flags
)
{...}

Parameters

[in, optional] SocketContext

A pointer to the socket context for the connection-oriented socket that has been disconnected. The WSK application provided this pointer to the WSK subsystem in one of the following ways:

  • It called the WskSocket function to create the socket.
  • It called the WskSocketConnect function to create the socket.
  • It called the WskAccept function to accept the socket as an incoming connection.
  • Its WskAcceptEvent event callback function was called to accept the socket as an incoming connection.

[in] Flags

A ULONG value that contains a bitwise OR of a combination of the following flags:

WSK_FLAG_ABORTIVE

The remote application performed an abortive disconnect of the socket. If this flag is not set, the remote application performed a graceful disconnect of the socket.

WSK_FLAG_AT_DISPATCH_LEVEL

The WSK subsystem called the WskDisconnectEvent event callback function at IRQL = DISPATCH_LEVEL. If this flag is not set, the WSK subsystem might have called the WskDisconnectEvent event callback function at any IRQL <= DISPATCH_LEVEL.

Return value

A WSK application's WskDisconnectEvent event callback function must always return STATUS_SUCCESS.

Remarks

The WSK subsystem calls a WSK application's WskDisconnectEvent event callback function when a connection-oriented socket is disconnected by the remote application only if the event callback function was previously enabled with the SO_WSK_EVENT_CALLBACK socket option. For more information about enabling a socket's event callback functions, see Enabling and Disabling Event Callback Functions.

If the remote application performed a graceful disconnect of the socket, no further data will be received from the socket. However, the WSK application can still send data to the socket until the socket is either completely closed by the remote application or the WSK application calls the WskDisconnect function or the WskCloseSocket function on the socket.

If the remote application performed an abortive disconnect of the socket, no further data will be received from the socket and no further data can be sent to the socket.

The WSK subsystem calls a WSK application's WskDisconnectEvent event callback function at IRQL <= DISPATCH_LEVEL.

A WSK application's WskDisconnectEvent event callback function must not wait for completion of other WSK requests in the context of WSK completion or event callback functions. The callback can initiate other WSK requests (assuming that it doesn't spend too much time at DISPATCH_LEVEL), but it must not wait for their completion even when the callback is called at IRQL = PASSIVE_LEVEL.

Requirements

Requirement Value
Minimum supported client Available in Windows Vista and later versions of the Windows operating systems.
Target Platform Windows
Header wsk.h (include Wsk.h)
IRQL <= DISPATCH_LEVEL

See also

WSK_CLIENT_CONNECTION_DISPATCH

WskAccept

WskAcceptEvent

WskCloseSocket

WskConnect

WskControlSocket

WskDisconnect

WskSocket

WskSocketConnect