| Previous | Next |
| WSAEFAULT | WSAEMFILE |
WSAEINVAL
WSAEINVAL is broader than a malformed integer or null pointer. In Winsock it can also report an API call that is valid in isolation but invalid at the current point in the socket lifecycle. Calling accept before listen, choosing an unsupported option level, or using flags that contradict the operation are common examples.
Why context matters
The same code can describe a construction error or a state-machine error. A parameter dump alone may look correct, while the preceding bind, listen, connect, shutdown, or close changed which calls were legal. Treat the socket state and the call sequence as part of the input.
What to capture
- The failing API and every supplied option, flag, family, type, protocol, and address length.
- A short lifecycle trace from socket creation through the failing call.
- Whether asynchronous notification or another thread can alter the socket between validation and use.
Microsoft: accept prerequisites · Microsoft: Winsock error codes · The Open Group: socket interface
Looking for a different code? Search another status or error code.