Winsock Error Codes - Brought to you by Winsock-Error.com

10022 "Invalid argument."

WSAEINVAL (Winsock error number: 10022)

Microsoft say this about Winsock error 10022 - 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.

Full details of Winsock TCP error 10022 - WSAEINVAL:

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).

   
This page is designed to help you to understand Winsock TCP error 10022. It will not necessarily mean you can instantly fix issues when your computer tells you that Winsock is having problems with code 10022, rather it will give you the necessary background information to help solve the matter.

Programming declarations for 10022 (WSAEINVAL):

C#
long WSAEINVAL = 10022 ;

VB.net
Dim WSAEINVAL As Long = 10022

VB6
Dim WSAEINVAL As Long
WSAEINVAL = 10022