What does Windows error code 10111 (WSA_E_CANCELLED) mean?

 
Previous Next
WSA_E_NO_MORE WSAEREFUSED

WSA_E_CANCELLED

WSA_E_CANCELLED reports cancellation of a Winsock namespace lookup. The documented case is a call to WSALookupServiceEnd while another call to WSALookupServiceNext for the same lookup is still processing.

Cancellation changes result ownership

The canceled Next call does not produce a partial result that the application may safely inspect. Microsoft states that its result-buffer data is undefined. The worker must take the cancellation path and discard the buffer contents.

Concurrency rules to make explicit

  • Define which thread owns the lookup handle.
  • Serialize normal enumeration completion and external cancellation.
  • Keep the handle alive until the blocked or in-progress lookup has observed cancellation.
  • Record cancellation as an intentional lifecycle event when initiated by application shutdown.

For compatibility, also handle the older WSAECANCELLED value. Microsoft documents both and recommends checking both because namespace providers can use either code. A new query requires a new WSALookupServiceBegin context.

Microsoft: WSALookupServiceNext · Microsoft: WSALookupServiceEnd


Looking for a different code? Search another status or error code.