Windows Sockets Error Codes

Overview

The Windows Sockets API (Winsock) defines a set of error codes that are returned by Winsock functions when an error occurs. These codes help developers diagnose and resolve networking issues in their Windows applications. This document provides a comprehensive list of common Winsock error codes, their meanings, and potential causes.

Common Winsock Error Codes

Error Code (Decimal) Symbolic Name Description
10004 WSABASEERROR Operation has been cancelled.
10009 WSAEINTR An interrupted system call caused the operation to be cancelled.
10013 WSAEACCES An attempt was made to access a socket in a way forbidden by its access permissions.
10014 WSAEDESTADDRREQ A destination address was required but was not supplied.
10015 WSAEFAULT Bad address. The system detected an invalid pointer address in attempting to use a pointer argument in a call.
10016 WSAEINVAL An invalid argument was supplied.
10022 WSAEINPROGRESS A blocking Winsock 1.1 call was made, or the service provider was still processing a callback function.
10024 WSAENOTBLOCK An operation was attempted on a non-blocking socket that should block.
10035 WSAEWOULDBLOCK A non-blocking socket operation could not be completed immediately.
10036 WSAEMSGSIZE A message is too long to be sent at this time.
10037 WSAENOTSOCK An operation was attempted on something that is not a socket.
10038 WSAENOTCONN A request to send or receive data was disallowed because the socket is not connected.
10039 WSAESHUTDOWN A request to send or receive data was disallowed because the socket had already been shut down in that direction.
10040 WSAETIMEOUT A connection attempt failed because the connected party did not properly respond after a period of time.
10041 WSAECONNREFUSED A connection attempt failed because the connected party did not properly respond after a period of time.
10042 WSAELOOP Too many symbolic links encountered.
10043 WSAENAMETOOLONG A specified file name or component name was too long.
10044 WSAEHOSTDOWN A socket operation failed because the destination host is down.
10045 WSAEHOST_NOT_FOUND A name-resolution system returned a failure when a name was being translated.
10046 WSAENETDOWN A socket operation failed because the network subsystem failed.
10047 WSAENOTAVAILABLE A Winsock implementation error occurred.
10048 WSAENETRESET The network dropped the connection on the socket.
10049 WSAENETUNREACH A socket operation tried to use an unreachable network.
10050 WSAETIMEDOUT A connection attempt failed because the connected party did not properly respond after a period of time.
10051 WSAECONNABORTED An established connection was aborted by the software on your host machine.
10052 WSAECONNRESET An established connection was aborted by the software on your host machine.
10053 WSAEADDRINUSE An attempt was made to access a socket with a name that is already in use.
10054 WSAEADDRNOTAVAIL A requested address was not valid in its context.
10055 WSAENOPROTOOPT An attempt was made to set a protocol-specific option that is not valid for the socket.
10056 WSAEPROTOTYPE The specified protocol is not supported by this protocol family.
10057 WSAEPROTONosupport The requested protocol is not supported by the Winsock implementation.
10058 WSAESOCKTNOSUPPORT The support for the specified socket type does not exist, or the support for the specified protocol is not implemented.
10059 WSAEOPNOTSUPP The attempted operation is not supported for the type of object referenced.
10060 WSAEPFNOSUPPORT The specified protocol family or implementation is not supported.
10061 WSAEPROCLIM A WinSock implementation has exceeded its configured limit for serving, or the maximum number of service requests for the specified transport protocol has been exceeded.
10064 WSAESOCKWRONGPROTO A protocol specified in the protocol request is different from the protocol that the socket is associated with.
10065 WSAEPROMISC A request to send or receive data was disallowed because the socket is not connected.
10067 WSAEREMOTE A socket operation was attempted on a remote machine.
10068 WSAENOLINK The system is no longer attached to the network.
10069 WSAELOOP Too many symbolic links encountered.
10070 WSAENAMETOOLONG A specified file name or component name was too long.
10071 WSAEFSM An unspecified file system error occurred.
10072 WSAEHOST_UNREACHABLE A socket operation tried to use an unreachable network.
10073 WSAEPROCESS_LIMIT A WinSock implementation has exceeded its configured limit for serving, or the maximum number of service requests for the specified transport protocol has been exceeded.
10100 WSANOTINITIALISED A successful Windows Sockets operation did not occur because Winsock2.dll was not initialized.
10101 WSAEDISCON A graceful shutdown in progress.
10102 WSAENOMORE No more data is available.
10103 WSAECANCELLED A blocking Winsock 1.1 call was made, or the service provider was still processing a callback function.
10104 WSAERECEIVE_PARTIAL Not all of the requested data was returned.
10105 WSAESEND_PARTIAL Not all of the requested data was sent.
10106 WSA_OPERATION_ABORTED An operation was successfully aborted.

Getting More Information

For detailed explanations of specific error codes and their implications, please refer to the official Microsoft documentation for the Windows Sockets API.

Note: Error codes are specific to the Winsock implementation and the underlying operating system version. Always consult the documentation relevant to your target environment.