104

Winsock Error Descriptions

Winsock Error Descriptions

WSABASEERR (1000) No Error

No Error. There's at least one WinSock implementation that will occasionally fail a function and report this as the error value, even though the function succeeded. You should simply ignore this error when it occurs.

WSAEINTR (10004) Interrupted system call

A blocking operation was interrupted by a call to WSACancelBlockingCall. An asynchronous signal (such as SIGINT or SIGQUIT) was caught by the process during the execution of an interruptible function. If the signal handler performs a normal return, the interrupted function call will seem to have returned the error condition.

Developer suggestions: You need to be prepared to handle this error on any functions that reference blocking sockets, or any calls to blocking functions, if you allow the user to cancel a blocking call. Whether to handle it as a fatal error or non-fatal error depends on the application and the context, so it's up to you to decide.

WSAEBADE (10009) Bad file number

A file descriptor argument was out of range, referred to no open file, or a read (write) request was made to a file that was only open for writing (reading).

WinSock description: No equivalent in WinSock. However, because a BSD socket is equivalent to a file handle, some Windows Sockets platforms provide some file handle and socket equivalency. In this case, the WSAEBADF error might mean the same as a WSAENOTSOCK error.

WSAEACCES (10013) Permission denied

An attempt was made to access a file in a way forbidden by its file access permissions. The file's permission setting does not allow the specified access. This error signifies that an attempt was made to access a file (or, in some cases, a directory) in a way that is incompatible with the file's attributes. For example, the error can occur when an attempt is made to read from a file that is not open, to open an existing read-only file for writing, or to open a directory instead of a file. Under MS-DOS versions 3.0 and later, EACCES may also indicate a locking or sharing violation. The error can also occur in an attempt to rename a file or directory or to remove an existing directory.

WSAEFAULT (10014) Bad address

The system detected an invalid address in attempting to use an argument of a call.

WSAEFAULT (10022) 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.

WSAEMFILE (10024) Too many open files

No process may have more than a system-defined number of file descriptors open at a time. No more file handles are available, so no more files can be opened.. Generically, the error means the network system has run out of socket handles.

User suggestions: There may be too many Winsock applications running simultaneously, but this is unlikely since most network systems have many socket handles available. This error also could occur if an application opens and closes sockets often, but doesn't properly close the sockets (so it leaves them open, as 'orphans'). To recover the orphaned sockets, you can try closing the application and restarting it to recover the open sockets; you may have to end all Winsock applications (to force an unload of the Winsock DLL).

WSAEWOULDBLOCK (10035) Operation would block

This is a temporary condition and later calls to the same routine may complete normally. The socket is marked as non-blocking (non-blocking operation mode), and the requested operation is not complete at this time.

WSAEINPROGRESS (10036) Operation now in progress

An operation that takes a long time to complete (such as a connect) was attempted on a non-blocking socket.

Winsock description: The Windows Sockets definition of this error is very different from Berkeley Sockets. Winsock only allows a single blocking operation to be outstanding per task (or thread), and if you make any other function call (whether or not it references that or any other socket) the function fails with the WSAEINPROGRESS error. It means that there is a blocking operation outstanding.

It is also possible that Winsock might return this error after an application calls connect a second time on a non-blocking socket while the connection is pending (i.e. after the first failed with WSAEWOULDBLOCK). This is what occurs in Berkeley Sockets.

WSAEALREADY (10037) Operation already in progress

An operation was attempted on a non-blocking object that already had an operation in progress.

WinSock description: WSAEALREADY means that the asynchronous operation you attempted to cancel has already been canceled. However, there's little distinction between WSAEALREADY and WSAEINVAL since a WinSock DLL cannot tell the difference between an asynchronous operation that has been cancelled and one that was never valid.

Additional functions: Berkeley sockets connect returns this error on subsequent calls, after an initial call on a non-blocking socket. However, some WinSocks fail with WSAEINVAL you call connect. a second time (or subsequent) on a non-blocking socket.

WSAENOTSOCK (10038) Socket operation on non-socket

An operation was attempted on something that is not a socket. The specified socket parameter refers to a file, not a socket.

WSAEDESTADDRREQ (10039) Destination address required

A required address was omitted from an operation on a socket. The explanation is simple and obvious: in order to connect to or send to a destination address, you need to provide the destination address.

User suggestions: Did you enter a destination hostname? If so, then the application might have had a problem resolving the name.

WSAEMSGSIZE (10040) Message too long

A message sent on a socket was larger than the internal message buffer or some other network limit.

Recv and Recvfrom: If the datagram you read is larger than the buffer you supplied, then Winsock truncates the datagram (i.e. copies what it can into your buffer) and fails the function.

Send and Sendto: you cannot send a datagram as large as you've requested. Note that the v1.1 Winsock specification does not explicitly state that this error occurs if the value you request is larger than the WSAData.iMaxUdpDg returned from WSAStartup. Since the buffering requirements for sending are less than for receiving datagrams, it's conceivable that you can send a datagram larger than you can receive.

WSAEPROTOTYPE (10041) Protocol wrong type for socket

A protocol was specified that does not support the semantics of the socket type requested. For example, you cannot use the ARPA Internet UDP protocol with type SOCK_STREAM.

This error occurs if you specifically reference a protocol that isn't part of the address family you also reference. The only function that takes these two explicit parameters is socket.

WSAENOPROTOOPT (10042) Bad protocol option

A bad option or level was specified in a getsockopt(2) or setsockopt(2) call. The option is unknown or unsupported.

WSAEPROTONOSUPPORT (10043) Protocol not supported

The protocol has not been configured into the system, or no implementation for it exists. So, for example, if a Winsock implementation doesn't support SOCK_RAW with IPPROTO_IP (or any other protocol), then the socket call would fail with WSAEPROTONOSUPPORT (however, if it doesn't support SOCK_RAW at all, you should expect WSAESOCKTNOSUPPORT).

WSAESOCKTNOSUPPORT (10044) Socket type not supported

The support for the socket type has not been configured into the system or no implementation for it exists. The Winsock description for this error is 'the specified socket type is not supported in this address family.' So, for example, you can expect this error if a Winsock implementation doesn't support socket type SOCK_RAW within the Internet address family (AF_INET).

WSAEOPNOTSUPP (10045) Operation not supported on socket

The attempted operation is not supported for the type of object referenced. Usually this occurs when a file descriptor refers to a file or socket that cannot support this operation, for example, trying to accept a connection on a datagram socket.

WSAEPFNOSUPPORT (10046) Protocol family not supported

The protocol family has not been configured into the system or no implementation for it exists.

WSAEAFNOSUPPORT (10047) Address family not supported by protocol family

An address incompatible with the requested protocol was used. For example, you shouldn't necessarily expect to be able to use NS addresses with ARPA Internet protocols.

It also occurs with functions that take a socket handle and a sockaddr structure as input parameters. A socket already has a type (a protocol), and each sockaddr structure has an address family field to define its format. A function fails with WSAEAFNOSUPPORT if the address family referenced in sockaddr is not compatible with the referenced socket's protocol.

This error apparently also takes the place of WSAEPFNOSUPPORT (which means 'protocol family not supported'), since that error is not listed for socket. in the v1.1 WinSock specification.

WSAEADDRINUSE (10048) Address already in use

Only one usage of each address is normally permitted.

WinSock description: The 'address' they refer to, typically refers to the local 'socket name', which is made up of the 3-tuple: protocol, port-number and IP address.
User suggestions: Two of the same types of server applications cannot use the same port on the same machine. For instance, this error will occur if you try to run two applications that have FTP servers that both try to accept connections on port 21 (the standard FTP port). In this case, the 2nd application will fail with WSAEADDRINUSE.

WSAEADDRNOTAVAIL (10049) Can't assign requested address

Normally results from an attempt to create a socket with an address not on this machine.

WinSock description: The 'address' it refers to is the remote socket name (protocol, port and address). This error occurs when the sin_port value is zero in a sockaddr_in structure for connect or sendto.

This error also occurs when you are trying to name the local socket (assign local address and port number) with bind, but Windows Sockets doesn't ascribe this error to bind, for some unknown reason.

WSAENETDOWN (10050) Network is down

A socket operation encountered a dead network. Check your Winsock, protocol stack, network driver, and network interface card configuration. Note that this error occurs rarely, because a Winsock implementation cannot reliably detect hardware problems.

WSAENETUNREACH (10051) Network is unreachable

A socket operation was attempted to an unreachable network.

TCP/IP scenario: The local network system can generate this error if there is no a default route configured. Typically though, Winsock generates this error when it receives a 'host unreachable' ICMP message from a router. The ICMP message means that a router cannot forward the IP datagram, possibly because it did not get a response to an ARP request (which might mean the destination host is down). Note: this error may also result if you try to send a multicast packet and the default gateway does not support multicast (check your interface configuration).

WSAENETRESET (10052) Net dropped connection or reset

The host you were connected to crashed and rebooted. Try reconnecting at a later time.

WSAECONNABORTED (10053) Software caused connection abort

A connection abort was caused internal to your host machine. The software caused a connection abort because there is no space on the socket's queue and the socket cannot receive further connections.

WinSock description: The error can occur when the local network system aborts a connection. This would occur if WinSock aborts an established connection after data retransmission fails (receiver never acknowledges data sent on a datastream socket).

TCP/IP scenario: A connection will timeout if the local system doesn't receive an (ACK)nowledgement for data sent. It would also timeout if a (FIN)ish TCP packet is not ACK'd (and even if the FIN is ACK'd, it will eventually timeout if a FIN is not returned).

WSAECONNRESET (10054) Connection reset by peer

A connection was forcibly closed by a peer. This normally results from a loss of the connection on the remote socket due to a timeout or a reboot.

User suggestions: Some network systems have commands to report statistics. In this case, it might be possible to check the count of TCP RST packets received, or ICMP Port Unreachable packets. See other suggestions under WSAECONNABORTED.

WSAENOBUFS (10055) No buffer space available

An operation on a socket or pipe was not performed because the system lacked sufficient buffer space or because a queue was full.

This error indicates a shortage of resources on your system. It can occur if you're trying to run too many applications (of any kind) simultaneously on your machine. If this tends to occur after running certain applications for a while, it might be a symptom of an application that doesn't return system resources (like memory) properly. It may also indicate you are not closing the applications properly. If it persists, exit Windows or reboot your machine to remedy the problem. You can monitor available memory with Program Manager's 'Help/About...' command.

WSAEISCONN (10056) Socket is already connected

A connect request was made on an already connected socket; or, a sendto or sendmsg() request on a connected socket specified a destination when already connected.

Winsock description: Winsock doesn't support the sendmsg() function, and some Winsock implementations are not so strict as to require an application with a datagram socket to 'disconnect'--by calling connect with a AF_INET NULL destination address: INADDR_ANY (0.0.0.0), and port 0--before redirecting datagrams with sendto or connect. On a datastream socket, some applications use this error with a non-blocking socket calling connect to detect when a connection attempt has completed, although this is not recommended since some Winsocks fail with WSAEINVAL on subsequent connect calls.

WSAENOTCONN (10057) Socket is not connected

A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket) no address was supplied.

WSAESHUTDOWN (10058) Can't send after socket shutdown

A request to send data was disallowed because the socket had already been shut down with a previous shutdown call. By calling shutdown, you do a partial close of a socket, which means you have discontinued sending. The Winsock implementation will not allow you to send after this.

When you get this error it usually means the system was trying to send a message that was larger than the receiving system would accept OR the receiving system had a disk full condition (or something similar). The receiving system just stops receiving and has to close the socket to do so.

WSAETOOMANYREFS (10059) Too many references, can't splice

There are too many references to some kernel-level object; the associated resource has run out.

WSAETIMEDOUT (10060) Connection timed out

A connect or send request failed because the connected party did not properly respond after a period of time. (The timeout period is dependent on the communication protocol.)

Check the obvious first: check that the destination address is a valid IP address. If you used a hostname, did it resolve to the correct address? If the hostname resolution uses a local host table, it is possible you resolved to an obsolete address. Can you ping that hostname?

Do you have a router configured? Is the router up and running? (You can check by pinging it, and then ping an address on the other side of it.) Try a traceroute to the destination address to check that all the routers are functioning.

Check your subnet mask. If you don't have the proper subnet mask, your network system may treat a local address as a remote address (so it forwards addresses on the local subnet to the router, rather than broadcasting an ARP request locally), or vice versa.

WSAECONNREFUSED (10061) Connection refused

Connection refused: No connection could be made because the target machine actively refused it. This usually results from trying to connect to a service that is inactive on the foreign host.

User suggestions: Either you went to the wrong host, or the server application you're trying to contact isn't executing. Check the destination address you are using. If you used a hostname, did it resolve to the correct address? If the hostname resolution uses a local hosttable, it's possible you resolved to an old obsolete address. It's also possible that the local services file has an incorrect port number (although it's unlikely).

WSAELOOP (10062) Too many levels of symbolic links

A pathname lookup involved more than eight symbolic links. (Too many links were encountered in translating a pathname.)

WSAENAMETOOLONG (10063) File name too long

A component of a path name exceeded 255 (MAXNAMELEN) characters, or an entire path name exceeded 1023 (MAXPATHLEN-1) characters.

WSAEHOSTDOWN (10064) Host is down

The problem may be due to one of the following:

  • A socket operation failed because the destination host was down.
  • A socket operation encountered a dead host.
  • Networking activity on the local host has not been initiated.

WSAEHOSTUNREACH (10065) No Route to Host

A socket operation was attempted to an unreachable host.

TCP/IP scenario: In BSD-compatible implementations, the local network system generates this error if there isn't a default route configured. Typically, though, Winsock generates WSAENETUNREACH when it receives a 'host unreachable' ICMP message from a router instead of WSAEHOSTUNREACH. The ICMP message means that the router can't forward the IP datagram, possibly because it didn't get a response to the ARP request (which might mean the destination host is down).

WSAENOTEMPTY (10066) Directory not empty

A directory with entries other than `.'and `..' was supplied to a remove directory or rename call.

WSAEPROCLIM (10067) Too many processes

No equivalent in 4.3 BSD (Berkeley Sockets Definition) or comparable operating systems. If a Winsock implementation has an upper limit to the number of simultaneous tasks it can handle, an application's initial call to WSAStartup could fail with this error.

WSAEUSERS (10068) Too many users

The quota system ran out of table entries.

WSAEDQUOT (10069) Disc Quota Exceeded

A write to an ordinary file, the creation of a directory or symbolic link, or the creation of a directory entry failed because the user's quota of disk blocks was exhausted, or the allocation of an inode for a newly created file failed because the user's quota of inodes was exhausted.

WSAESTALE (10070) Stale NFS file handle

An attempt was made to access an open file on an NFS (Network File System) which is now unavailable as referenced by the file descriptor. This may indicate the file was deleted on the NFS server or some other catastrophic event occurred.

NFS is 'network-related' in the strictest sense, but the NFS protocol is an application protocol (that is, a 'high-level' protocol). The Windows Sockets API provides access to 'low-level' APIs (like the transport protocols TCP and UDP), so this error is not relevant to Winsock.

WSASYSNOTREADY (10091) Network SubSystem is unavailable

The Winsock implementation cannot function at this time, because the underlying system it uses to provide network services is currently unavailable. Try the following:

  • Check that the WINSOCK.DLL file is in the current path.
  • Check that the WINSOCK.DLL file is from the same vendor as your underlying protocol stack. You cannot mix and match. (WINSOCK DLLs must be supplied by the same vendor that provided your underlying protocol stack).You cannot use more than one Winsock implementation simultaneously.If you have more than one WINSOCK DLL on your system, be sure the first one in the path is appropriate for the network subsystem currently loaded.
  • Check your Winsock implementation documentation to be sure all necessary components are currently installed and configured correctly.

WSAVERNOTSUPPORTED (10092) WINSOCK DLL Version out of range

The current Winsock implementation does not support the Windows Sockets specification version requested by the application. Do you have the Winsock DLL that supports the version of the Winsock specification required by the application? If so, is there an older DLL in a directory in the path ahead of the directory containing the newer DLL? If not, check with your Winsock vendor to see if they have a newer Winsock available.

In other words, the Winsock you are using is not supported by the program you are using. You would need to update your Winsock to a supported version. In most cases, the default Winsock that comes with your OS is appropriate. However, there are some TCP/IP dialers that install their own Winsock.dll which may not be compatible with our programs.

WSANOTINITIALISED (10093) Successful WSASTARTUP not yet performed

Either your application hasn't called WSAStartup, or WSAStartup failed. There is another possibility: you are accessing a socket which the current active task does not own (that is, you're trying to share a socket between tasks).

Chances are the network subsystem is misconfigured or inactive.

WSAEREMOTE (10071) Too many levels of remote in path

Item is not local to the host. A server has attempted to handle an NFS request by generating a request to another NFS server, which is not allowed.

WSAHOST_NOT_FOUND (11001) Host not found

The name you have used is not an official hostname or alias. This is not a software error, another type of name server request may be successful. Any of the Winsock name resolution functions can fail with this error. The Winsock API does not provide any way to select specific name resolution protocols, server address, or record type.

TCP/IP scenario: Most Winsock implementations use domain name system (DNS) protocol for hostname to address resolution, although a few use Network Information System (NIS). Assuming you have a name server configured instead of or as well as a host table, a hostname resolution request causes a Winsock DLL to send a DNS 'A' record query (address query) to the configured DNS query. If you have more than one server configured, the hostname query fails only after the Winsock DLL has queried all servers.

Check that you have a name server(s) and/or host table configured. If you are using a name server(s), check whether the server host(s) are up. For example, you can try to ping the server(s).

You could also try to resolve another hostname you know should work, to check that the name resolution server application is running.

If you are using a host table exclusively, you'll need to update it to add the destination hostname and address.

WSATRY_AGAIN (11002) Non-Authoritative Host not found

This is usually a temporary error and means that the local server did not receive a response from an authoritative server. A retry at some time later may be successful. See HOST_NOT_FOUND for details.

WSANO_RECOVERY (11003) Non-Recoverable errors: FORMERR, REFUSED, NOTIMP

Windows Sockets specification notes the domain name system (DNS) errors 'FORMERR, REFUSED, and & NOTIMP. For protocols and services resolution, it means the respective database wasn't located.

Format error: Name server was unable to interpret the query.

Request refused: Name server refuses to satisfy your query for policy reasons.

Not implemented: Name server does not perform specified operation.

WSANO_DATA (11004)* Valid name, no data record of requested type

The requested name is valid, but does not have an Internet IP address at the name server. This is not a temporary error. This means another type of request to the name server will result in an answer. For protocol and services resolution, the name or number was not found in the respective database. WSAHOST_NOT_FOUND for details.

WSANO_ADDRESS (11004)* No address, look for MX record

The requested name is valid, but does not have an Internet IP address at the name server. This is not a temporary error. This means another type of request to the name server will result in an answer. For protocol and services resolution, the name or number was not found in the respective database. WSAHOST_NOT_FOUND for details.