This article describes the possible error codes that are returned by the WSAGetLastError (Wsapiref_2tiq.asp) function. The errors are listed in alphabetical order by error macro. Some error codes that are defined in Winsock2.h are not returned from any function. These error codes are not included in this article.
Translation: Interrupted function call.
Description: A blocking operation was interrupted by a call to WSACancelBlockingCall (Wsapiref_704y.asp).
Translation: Permission denied.
Description: An attempt was made to access a socket in a way that is forbidden by its access permissions. For example, this error occurs when a broadcast address is used for sendto but the broadcast permission is not set by using setsockopt(SO_BROADCAST). Another possible reason for the WSAEACCES error is that when the bind (Wsapiref_6vzm.asp) function is called (in Microsoft Windows NT 4 .0 Service Pack 4 [SP4] or later), another program, service, or kernel mode driver is bound to the same address with exclusive access. Such exclusive access is a new feature of Windows NT 4.0 SP4 and later, and it is implemented by using the SO_EXCLUSIVEADDRUSE option.
Translation: Bad address.
Description: The system detected an invalid pointer address when it tried to use a pointer argument of a call. This error occurs if a program passes an invalid pointer value or if the length of the buffer is too small. For example, this problem occurs if the length of an argument that is a SOCKADDR structure is smaller than the sizeof(SOCKADDR) value.
Translation: Invalid argument.
Description: An invalid argument (for example, an argument that specified an invalid level) was supplied to the setsockopt (Wsapiref_94aa.asp) function. Sometimes, it also refers to the current state of the sockets, for example, calling accept (Wsapiref_13aq.asp) on a socket that is not listening.
Translation: Too many open files.
Description: There are too many open sockets. Each implementation may have a maximum number of socket handles available. These handles may be available globally, per process, or per thread.
Translation: Resource temporarily unavailable.
Description: This error is returned from operations on nonblocking sockets that cannot be completed immediately, for example, recv (Wsapiref_2i9e.asp), when no data is queued to be read from the socket. It is a nonfatal error, and the operation can be retried later. WSAEWOULDBLOCK is typically reported as the result of calling connect (Wsapiref_8m7m.asp) on a nonblocking SOCK_STREAM socket because some time must elapse for the connection to be established.
Translation: Operation now in progress.
Description: A blocking operation is currently running. Windows Sockets only permits a single blocking operation for each task or for each thread to be outstanding. If any other function call is made (whether it references that or any other socket), the function fails with the WSAEINPROGRESS error.
Translation: Operation already in progress.
Description: An operation is tried on a nonblocking socket when an operation is already in progress. For example, calling connect (Wsapiref_8m7m.asp) is tried a second time on a nonblocking socket that is already connecting or an asynchronous request (WSAAsyncGetXbyY) is tried that has already been canceled or completed.
Translation: Socket operation on nonsocket.
Description: An operation was tried on something that is not a socket. Either the socket handle parameter did not reference a valid socket, or for select (Wsapiref_1ab6.asp), a member of an fd_set was not valid.
Translation: Destination address required.
Description: A required address was omitted from an operation on a socket. For example, this error is returned if sendto (Wsapiref_4sqa.asp) is called with the remote address of ADDR_ANY.
Translation: Message too long.
Description: A message that is sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer that is used to receive a datagram was smaller than the datagram itself.
Translation: Protocol wrong type for socket.
Description: A protocol that is specified in the socket (Wsapiref_2qr6.asp) function call does not support the semantics of the socket type that is requested. For example, the ARPA Internet UDP protocol cannot be specified with a socket type of SOCK_STREAM.
Translation: Bad protocol option.
Description: An unknown, invalid, or unsupported option or level was specified in a getsockopt (Wsapiref_8qcy.asp) call or a setsockopt (Wsapiref_94aa.asp) call.
Translation: Protocol not supported.
Description: The requested protocol has either not been configured in the system or no implementation for it exists. For example, a socket (Wsapiref_2qr6.asp) call requests a SOCK_DGRAM socket, but it specifies a stream protocol.
Translation: Socket type not supported.
Description: The support for the specified socket type does not exist in this address family. For example, the SOCK_RAW optional type may be selected in a socket (Wsapiref_2qr6.asp) call but the implementation does not support SOCK_RAW sockets at all.
Translation: Operation not supported.
Description: The operation that was tried is not supported for the type of object that is referenced. This error typically occurs when a socket descriptor to a socket that cannot support this operation is trying to accept a connection on a datagram socket.
Translation: Protocol family not supported.
Description: The protocol family has not been configured in the system or no implementation for it exists. This message has a slightly different meaning from WSAEAFNOSUPPORT. However, it is frequently interchangeable. All Windows Sockets functions that return one of these messages also specify WSAEAFNOSUPPORT.
Translation: Address family not supported by protocol family.
Description: An address that is incompatible with the requested protocol was used. All sockets are created with an associated address family (that is, AF_INET for Internet protocols) and a generic protocol type (that is, SOCK_STREAM). This error is returned if an incorrect protocol is explicitly requested in the socket (Wsapiref_2qr6.asp) call or if an address of the wrong family is used for a socket, for example, in sendto (Wsapiref_4sqa.asp).
Translation: Address already in use.
Description: Typically, only one usage of each socket address (protocol/IP address/port) is permitted. This error occurs if a program tries to bind (Wsapiref_6vzm.asp) a socket to an IP address or port that has already been used for an existing socket, a socket that was not closed correctly, or a socket that is still in the process of closing. For server programs that have to bind multiple sockets to the same port number, consider using setsockopt (Wsapiref_94aa.asp)(SO_REUSEADDR). Client programs typically do not have to call bind at all, connect (Wsapiref_8m7m.asp) chooses an unused port automatically. When a bind is called with a wildcard address (involving ADDR_ANY), a WSAEADDRINUSE error may be delayed until the specific address is committed. This may occur with a call to another function that occurs later, including connect, listen, WSAConnect, or WSAJoinLeaf.
Translation: Cannot assign requested address.
Description: The requested address is not valid in its context. This error typically results from an attempt to bind (Wsapiref_6vzm.asp) to an address that is not valid for the local computer. This error can also result from connect (Wsapiref_8m7m.asp), sendto (Wsapiref_4sqa.asp), WSAConnect (Wsapiref_8kc2.asp), WSAJoinLeaf (Wsapiref_7dv6.asp), or WSASendTo (Wsapiref_752q.asp) when the remote address or port is not valid for a remote computer (for example, address or port 0).
Translation: Network is down.
Description: A socket operation encounters a dead network. This error may indicate a serious failure of the network system (that is, the protocol stack that the Windows Sockets DLL runs over), the network interface, or the local network itself.
Translation: Network is unreachable.
Description: A socket operation is tried to an unreachable network. This error typically means the local software knows no route to reach the remote host.
Translation: Network dropped connection on reset.
Description: The connection has been broken because of keep-alive activity that detects a failure while the operation was in progress. It can also be returned by setsockopt (Wsapiref_94aa.asp) if an attempt is made to set SO_KEEPALIVE on a connection that has already failed.
Translation: Software caused connection abort.
Description: An established connection was stopped by the software in your host computer, possibly because of a data transmission time-out or protocol error.
Translation: Connection reset by peer.
Description: An existing connection was forcibly closed by the remote host. This error typically occurs if the peer program on the remote host is suddenly stopped, the host is restarted, or the remote host uses a hard close. See setsockopt (Wsapiref_94aa.asp) for more information about the SO_LINGER option on the remote socket. This error may also result if a connection was broken because of keep-alive activity that detects a failure while one or more operations are in progress. Operations that were in progress fail with WSAENETRESET. Subsequent operations fail with WSAECONNRESET.
Translation: No buffer space available.
Description: An operation on a socket cannot be performed because the system lacked sufficient buffer space or because a queue was full.
Translation: Socket is already connected.
Description: A connect request was made on an already-connected socket. Some implementations also return this error if sendto (Wsapiref_4sqa.asp) is called on a connected SOCK_DGRAM socket (for SOCK_STREAM sockets, the To parameter in sendto (Wsapiref_4sqa.asp) is ignored) although other implementations treat this as a valid occurrence.
Translation: Socket is not connected.
Description: A request to send or receive data is not permitted because the socket is not connected and (when sending on a datagram socket using sendto [Wsapiref_4sqa.asp], no address was supplied). Any other type of operation may also return this error, for example, setsockopt (Wsapiref_94aa.asp) setting SO_KEEPALIVE if the connection has been reset.
Translation: Cannot send after socket shutdown.
Description: A request to send or receive data was not permitted because the socket had already been shut down in that direction with a previous shutdown (Wsapiref_60z6.asp) call. When a shutdown is called, a partial close of a socket is requested. This is a signal that the sending or receiving processes (or both) have been discontinued.
Translation: Connection timed out.
Description: A connection attempt failed because the connected party did not correctly respond after a period of time, or the established connection failed because the connected host failed to respond.
Translation: Connection refused.
Description: No connection can be made because the destination computer actively refuses it. This error typically results from trying to connect to a service that is inactive on the foreign host, that is, one that does not have a server program running.
Translation: Host is down.
Description: A socket operation failed because the destination host is down. A socket operation encountered a dead host. Networking activity on the local host has not been initiated. These conditions are more likely to be indicated by the error WSAETIMEDOUT.
Translation: No route to host.
Description: A socket operation was tried to an unreachable host. See WSAENETUNREACH.
Translation: Too many processes.
Description: A Windows Sockets implementation may have a limit on the number of programs that can use it at the same time. WSAStartup (Wsapiref_1v8y.asp) may fail with this error if the limit has been reached.
Translation: Network subsystem is unavailable.
Description: This error is returned by WSAStartup (Wsapiref_1v8y.asp) if the Windows Sockets implementation cannot currently function because the underlying system it uses to provide network services is currently unavailable. Confirm the following:
Confirm that the appropriate Windows Sockets DLL file is in the current path.
Confirm that they are not trying to use more than one Windows Sockets implementation at the same time.
If there is more than one Winsock DLL on your system, confirm that the first Winsock DLL in the path is appropriate for the network subsystem currently loaded.
Confirm that all the required components are currently installed and configured correctly according to the Windows Sockets implementation documentation.
Translation: Winsock.dll version out of range.
Description: The current Windows Sockets implementation does not support the Windows Sockets specification version requested by the program. Make sure that no old Windows Sockets DLL files are being accessed.
Translation: Successful WSAStartup not yet performed.
Description: Either the program has not called WSAStartup (Wsapiref_1v8y.asp) or WSAStartup (Wsapiref_1v8y.asp) failed. The program may be accessing a socket that the current active task does not own (that is, it is trying to share a socket between tasks), or WSACleanup has been called too many times.
Translation: Graceful shutdown in progress.
Description: This error is returned by WSARecv (Wsapiref_4z1u.asp) and WSARecvFrom (Wsapiref_4wky.asp) to indicate that the remote party has initiated a graceful shutdown sequence.
Translation: Class type not found.
Description: The specified class was not found.
Translation: Host not found. No such host is known.
Description: The name is not an official host name or alias, or it cannot be found in the databases that are being queried. This error may also be returned for protocol and service queries, and it means that the specified name cannot be found in the relevant database.
Translation: Nonauthoritative host not found.
Description: This error is typically a temporary error during host name resolution, and it means that the local server did not receive a response from an authoritative server. A retry at some time later may be successful.
Translation: This is a nonrecoverable error.
Description: This error indicates that some sort of nonrecoverable error occurred during a database lookup. This error may occur if the database files (for example, BSD-compatible HOSTS, SERVICES, or PROTOCOLS files) cannot be found or if a DNS request was returned by the server with a severe error.
Translation: Valid name, no data record of requested type.
Description: The requested name is valid and was found in the database, but it does not have the correct associated data that it is being resolved for. The typical example for this is a host name-to-address translation attempt (using gethostbyname [Wsapiref_0q5u.asp] or WSAAsyncGetHostByName [Wsapiref_7bhu.asp]) that uses the DNS server. An MX record is returned but no A record. This indicates that the host itself exists, but it is not directly reachable.
WSA_INVALID_HANDLE (Operating system dependent)
Translation: Specified event object handle is invalid.
Description: A program tried to use an event object, but the specified handle is not valid.
WSA_INVALID_PARAMETER (Operating system dependent)
Translation: One or more parameters are invalid.
Description: A program used a Windows Sockets function that directly maps to a Win32 function. The Win32 function is indicating a problem with one or more parameters.
WSA_IO_INCOMPLETE (Operating system dependent)
Translation: Overlapped I/O event object not in signaled state.
Description: The program has tried to determine the status of an overlapped operation that is not yet completed. Programs that use WSAGetOverlappedResult (with the fWait flag set to FALSE) in a polling mode to determine when an overlapped operation has completed receive this error code until the operation is complete.
WSA_IO_PENDING (Operating system dependent)
Translation: Overlapped operations will complete later.
Description: The program has initiated an overlapped operation that cannot be completed immediately. A completion indication is sent later when the operation has been completed.
WSA_NOT_ENOUGH_MEMORY (Operating system dependent)
Translation: Insufficient memory available.
Description: A program used a Windows Sockets function that directly maps to a Win32 function. The Win32 function is indicating a lack of required memory resources.
WSA_OPERATION_ABORTED (Operating system dependent)
Translation: Overlapped operation aborted.
Description: An overlapped operation was canceled because the socket was closed or the SIO_FLUSH command in WSAIoctl (Wsapiref_6ik2.asp) was ran.
WSAINVALIDPROCTABLE (Operating system dependent)
Translation: Invalid procedure table from service provider.
Description: A service provider returned an invalid procedure table to Ws2_32.dll. (This is typically caused by one or more of the function pointers being null.)
WSAINVALIDPROVIDER (Operating system dependent)
Translation: Invalid service provider version number.
Description: A service provider returned a version number other than 2.0.
WSAPROVIDERFAILEDINIT (Operating system dependent)
Translation: Unable to initialize a service provider.
Description: Either a service provider's DLL cannot be loaded (LoadLibrary failed) or the provider's WSPStartup/NSPStartup function failed.
WSASYSCALLFAILURE (Operating system dependent)
Translation: System call failure.
Description: This error is returned when a system call that should never fail fails. For example, this error occurs if a call to WaitForMultipleObjects fails or one of the registry functions fails trying to change the protocol or name space catalogs.