| Previous | Next |
| WSAESOCKTNOSUPPORT | WSAEPFNOSUPPORT |
WSAEOPNOTSUPP
WSAEOPNOTSUPP means that the socket exists, but the attempted operation does not make sense for its type, protocol, direction, or provider. It is therefore a contract mismatch between an API call and an otherwise valid socket, not a generic connectivity failure.
Examples of incompatible operations
A connection-oriented operation such as accept is not meaningful for a datagram socket. Out-of-band flags are meaningful only where the socket and transport support them. Some providers also expose one-way or constrained socket types that cannot perform every send/receive operation. The same application may work on a stream socket and fail immediately after a refactor changes the type to datagram.
How to fix it
- Validate the intended transport semantics before calling the operation, rather than treating all sockets as interchangeable.
- Log socket family, type, protocol, current connect/listen/shutdown state, and any flags supplied.
- Design separate lifecycle paths for listeners, connected streams, unconnected datagrams, and provider-specific sockets.
Microsoft: accept · Microsoft: WSARecv · The Open Group: socket abstractions
Looking for a different code? Search another status or error code.