What does errno 95 (ENOTSOCK) mean?

 
Could be also:
ConstantTypeOS
EOPNOTSUPPerrnoLinux
EMULTIHOPerrnoMac
SECURITY_INITIALIZATION_FAILEDBugCheck CodeWindows
Previous Next
EMULTIHOP EPFNOSUPPORT

ENOTSOCK

A valid integer descriptor can still be the wrong object type

ENOTSOCK is returned when a socket operation is applied to a non-socket descriptor. The descriptor may be numerically valid and open; the failure is that it refers to another object type such as a file, pipe, or unrelated device.

This makes ENOTSOCK different from EBADF, which covers an invalid file descriptor, and from EBADFD, which Solaris uses for a descriptor in a bad state. Descriptor reuse after close is a particularly important application-level cause: the same integer can later identify a different object.

Descriptor provenance checks

  • Trace creation, duplication, close, and handoff of the descriptor passed to the failing socket API.
  • In asynchronous code, check lifetime races where a socket is closed and its integer descriptor is reused before a queued operation executes.
  • Preserve object type and ownership metadata in debug builds instead of logging only the descriptor number.

References


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