Table of contents
Collapse the table of content
Expand the table of content

Winsock Kernel Events

Last Updated: 9/2/2016

The Winsock Kernel (WSK) subsystem can asynchronously notify a WSK application when certain socket events occur, such as when new data has been received on a socket or when a socket has been disconnected. In order for a WSK application to be asynchronously notified of socket events, the WSK application must implement the appropriate event callback functions and enable those event callback functions on the sockets that it creates.

Note A WSK application is not required to implement or use event callback functions. A WSK application can perform most WSK socket operations by calling the appropriate WSK socket functions. The only WSK feature that requires using event callback functions is conditional-accept mode on listening sockets. For more information about the advantages and disadvantages between using WSK functions versus using event callback functions, see Using Winsock Kernel Functions vs. Event Callback Functions.

Each WSK socket category supports a different set of socket events.

Basic sockets

Basic sockets do not support any socket events.

Listening sockets

EventEvent callback function

An incoming connection has been accepted.


An incoming connection request has arrived.


An incoming connection request has been dropped.


* Applies only to listening sockets that have conditional-accept mode enabled. For more information about using conditional accept mode with listening sockets, see Listening for and Accepting Incoming Connections.

Datagram sockets

EventEvent callback function

One or more new datagrams have been received.


Connection-oriented sockets

EventEvent callback function

New data has been received.


The socket has been disconnected.


The ideal send backlog size has changed.


When a WSK application creates a socket, the socket's event callback functions are disabled by default. A WSK application must enable a socket's event callback functions in order for the WSK subsystem to call the socket's event callback functions when socket events occur. For more information about enabling and disabling a socket's event callback functions, see Enabling and Disabling Event Callback Functions.

If a WSK application registers an extension interface for a socket, the extension interface might support additional events. For more information about registering an extension interface for a socket, see Registering an Extension Interface.

The WSK subsystem can also notify a WSK application of events that are not specific to a particular socket. In order for a WSK application to be notified of these events, the WSK application must implement a WskClientEvent event callback function. There are currently no events defined that are not specific to a particular socket. A WSK application's WskClientEvent event callback function is always enabled and cannot be disabled.

A WSK application's event callback functions 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.

© 2016 Microsoft