What does Windows error code 10038 (WSAENOTSOCK) mean?

 
Previous Next
WSAEALREADY WSAEDESTADDRREQ

WSAENOTSOCK

WSAENOTSOCK means that the argument passed as a socket does not currently identify a Winsock socket. It is usually an application lifecycle or type-handling defect, not a remote networking problem.

Common ways this happens

A socket may have been closed and then reused, a non-socket handle may have been passed through a generic handle abstraction, or concurrent teardown may race with an I/O or readiness call. The failure can also follow incorrect cross-process hand-off: Windows supports socket duplication through WSADuplicateSocket, but simply copying a numeric handle value to another process is not the same thing.

How to investigate

  • Record creation, duplication, ownership transfer, and close events with the numeric SOCKET value.
  • Ensure one component owns the transition to closed and that pending I/O observes that state before reusing objects.
  • Check that socket APIs are not being called on ordinary file, event, or CRT-descriptor values.

Microsoft: accept errors · Microsoft: WSADuplicateSocket · The Open Group: socket descriptors


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