Knowledge Base > External Error Codes > TCP/IP - Error Messages of the TCP/IP-Stack

TCP/IP - Error Messages of the TCP/IP-Stack

The following is a list of possible error codes returned by the WSAGetLastError function, along with their explanations. The error numbers are consistently set across all Windows Sockets-compliant implementations.


Windows Sockets code Berkeley equivalent

Error

Interpretation

WSAEINTR EINTR 10004 As in standard C
WSAEBADF EBADF 10009 As in standard C
WSAEACCES EACCES 10013 As in standard C
WSAEDISCON None 10101 The message terminated gracefully. Used only for message-oriented protocols.
WSAEFAULT EFAULT 10014 As in standard C
WSAEINVAL EINVAL 10022 As in standard C
WSAEMFILE EMFILE 10024 As in standard C
WSAEWOULDBLOCK EWOULDBLOCK 10035 As in BSD
WSAEINPROGRESS EINPROGRESS 10036 This error is returned if anyWindows Sockets function is called while a blocking function is in progress.
WSAEALREADY EALREADY 10037 As in BSD
WSAENOTSOCK ENOTSOCK 10038 As in BSD
WSAEDESTADDRREQ EDESTADDRREQ 10039 As in BSD
WSAEMSGSIZE EMSGSIZE 10040 As in BSD
WSAEPROTOTYPE EPROTOTYPE 10041 As in BSD
WSAENOPROTOOPT ENOPROTOOPT 10042 As in BSD
WSAEPROTONOSUPPORT EPROTONOSUPPORT 10043 As in BSD
WSAESOCKTNOSUPPORT ESOCKTNOSUPPORT 10044 As in BSD
WSAEOPNOTSUPP EOPNOTSUPP 10045 As in BSD
WSAEPFNOSUPPORT EPFNOSUPPORT 10046 As in BSD
WSAEAFNOSUPPORT EAFNOSUPPORT 10047 As in BSD
WSAEADDRINUSE EADDRINUSE 10048 As in BSD
WSAEADDRNOTAVAIL EADDRNOTAVAIL 10049 As in BSD
WSAENETDOWN ENETDOWN 10050 As in BSD. This error may be reported at any time if the Windows Sockets implementation detects an underlying failure.
WSAENETUNREACH ENETUNREACH 10051 As in BSD
WSAENETRESET ENETRESET 10052 As in BSD
WSAECONNABORTED ECONNABORTED 10053 As in BSD
WSAECONNRESET ECONNRESET 10054 As in BSD
WSAENOBUFS ENOBUFS 10055 As in BSD
WSAEISCONN EISCONN 10056 As in BSD
WSAENOTCONN ENOTCONN 10057 As in BSD
WSAESHUTDOWN ESHUTDOWN 10058 As in BSD
WSAETOOMANYREFS ETOOMANYREFS 10059 As in BSD
WSAETIMEDOUT ETIMEDOUT 10060 As in BSD
WSAECONNREFUSED ECONNREFUSED 10061 As in BSD
WSAELOOP ELOOP 10062 As in BSD
WSAENAMETOOLONG ENAMETOOLONG 10063 As in BSD
WSAEHOSTDOWN EHOSTDOWN 10064 As in BSD
WSAEHOSTUNREACH EHOSTUNREACH 10065 As in BSD
WSASYSNOTREADY None 10091 Returned by WSAStartup, indicating that the network subsystem is unusable.
WSAVERNOTSUPPORTED None 10092 Returned by WSAStartup, indicating that the Windows Sockets DLL cannot support this app.
WSANOTINITIALISED None 10093 Returned by any function except WSAStartup, indicating that a successful WSAStartup, has not yet been performed.
WSAHOST_NOT_FOUND HOST_NOT_FOUND 11001 As in BSD
WSATRY_AGAIN TRY_AGAIN 11002 As in BSD
WSANO_RECOVERY NO_RECOVERY 11003 As in BSD
WSANO_DATA NO_DATA 11004 As in BSD

The first set of definitions is present to resolve contentions between standard C error codes which may be defined inconsistently between various C compilers.

The second set of definitions provides Windows Sockets versions of regular Berkeley Sockets error codes.

The third set of definitions consists of extended Windows Sockets-specific error codes.

The fourth set of errors are returned by Windows Sockets getXbyY and WSAAsyncGetXByY functions and correspond to the errors that in Berkeley software would be returned in the h_errno variable. They correspond to various errors that may be returned by the Domain Name Service. If the Windows Sockets implementation does not use the DNS, it will use the most appropriate code. In general, a Windows Sockets application should interpret WSAHOST_NOT_FOUND and WSANO_DATA as indicating that the key (name, address, and so on) was not found, while WSATRY_AGAIN and WSANO_RECOVERY suggest that the name service itself is nonoperational.

The error numbers are derived from the WINSOCK.H header file and are based on the fact that Windows Sockets error numbers are computed by adding 10000 to the "normal" Berkeley error number.

Note that this table does not include all of the error codes defined in WINSOCK.H. This is because it includes only errors that might reasonably be returned by a Windows Sockets implementation. WINSOCK.H, on the other hand, includes a full set of BSD definitions to ensure compatibility with ported software.