Winsock error 10022

WSAEINVAL  -  Invalid argument.

Basic (Microsoft) information for 10022 a.k.a. WSAEINVAL

Some invalid argument was supplied (for example, specifying an invalid level to the setsockopt function). In some instances, it also refers to the current state of the socket—for instance, calling accept on a socket that is not listening.

Detailed (Berkeley) information for winsock 10022, described as "Invalid argument."

Berkeley description: Some invalid argument was supplied (for example, specifying an invalid level to the setsockopt() function).

Microsoft C description: Invalid argument. An invalid value was given for one of the arguments to a function. For example, the value given for the origin when positioning a file pointer (by means of a call to fseek) is before the beginning of the file.

WinSock description: Similar to Berkeley & Microsoft C, the generic meaning is that an application passed invalid input parameter in a function call. The error refers to content as well as value (e.g. it may occur when a pointer to a structures is invalid or when a value in structure field is invalid). In some instances, it also refers to the current state of the socket input parameter.

Detailed descriptions (relevant to socket states):

accept(): listen() was not invoked prior to

bind(): socket already bound to an address

getsockname(): socket not bound with

listen(): socket not bound with or already connected.

recv() & recvfrom(): socket not bound (for Dgram) or not yet connected (for Stream), or the requested length is zero (whether a length >32K

is acceptable as a non-negative value is unclear, so don't use them).

send() & sendto(): socket not bound (for Dgram) or not yet connected (for Stream)

The v1.1 specification also has a detailed description for the connect() function which says: "socket not already bound to an address." This text is a typo which makes no sense. Ignore it. The standard meaning for WSAEINVAL applies to connect() (invalid argument).

[Home] [Full list of Winsock Error codes]
[Peer Monitor - network monitoring tool] [DanielClarke.com] [Hungarian language course]