1.1 WINDOWS平台SOCKET错误码说明<o:p></o:p>
MSDN对于SOCKET异常ID的描述<o:p></o:p>
错误码值<o:p></o:p> |
错误码标识<o:p></o:p> |
含义<o:p></o:p> |
10004<o:p></o:p> |
WSAEINTR<o:p></o:p> |
Interrupted function call. <o:p></o:p> A blocking operation was interrupted by a call to WSACancelBlockingCall.<o:p></o:p> |
10013<o:p></o:p> |
WSAEACCES<o:p></o:p> |
Permission denied. <o:p></o:p> An attempt was made to access a socket in a way forbidden by its access permissions. An example is using a broadcast address for sendto without broadcast permission being set using setsockopt(SO_BROADCAST). <o:p></o:p> |
10014<o:p></o:p> |
WSAEFAULT<o:p></o:p> |
Bad address. <o:p></o:p> The system detected an invalid pointer address in attempting to use a pointer argument of a call. This error occurs if an application passes an invalid pointer value, or if the length of the buffer is too small. For instance, if the length of an argument which is a struct sockaddr is smaller than sizeof(struct sockaddr). <o:p></o:p> |
10022<o:p></o:p> |
WSAEINVAL<o:p></o:p> |
Invalid argument. <o:p></o:p> 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. <o:p></o:p> |
10024<o:p></o:p> |
WSAEMFILE<o:p></o:p> |
Too many open files. <o:p></o:p> Too many open sockets. Each implementation may have a maximum number of socket handles available, either globally, per process or per thread. <o:p></o:p> |
10035<o:p></o:p> |
WSAEWOULDBLOCK<o:p></o:p> |
Resource temporarily unavailable. <o:p></o:p> This error is returned from operations on non-blocking sockets that cannot be completed immediately, for example recv when no data is queued to be read from the socket. It is a non-fatal error, and the operation should be retried later. It is normal for WSAEWOULDBLOCK to be reported as the result from calling connect on a non-blocking SOCK_STREAM socket, since some time must elapse for the connection to be established.<o:p></o:p> |
10036<o:p></o:p> |
WSAEINPROGRESS<o:p></o:p> |
Operation now in progress. <o:p></o:p> A blocking operation is currently executing. Windows Sockets only allows a single blocking operation to be outstanding per task (or thread), and if any other function call is made (whether or not it references that or any other socket) the function fails with the WSAEINPROGRESS error. <o:p></o:p> |
10037<o:p></o:p> |
WSAEALREADY<o:p></o:p> |
Operation already in progress. <o:p></o:p> An operation was attempted on a non-blocking socket that already had an operation in progress - i.e. calling connect a second time on a non-blocking socket that is already connecting, or canceling an asynchronous request (WSAAsyncGetXbyY) that has already been canceled or completed.<o:p></o:p> |
10038<o:p></o:p> |
WSAENOTSOCK<o:p></o:p> |
Socket operation on non-socket. <o:p></o:p> An operation was attempted on something that is not a socket. Either the socket handle parameter did not reference a valid socket, or for select, a member of an fd_set was not valid. <o:p></o:p> |
10039<o:p></o:p> |
WSAEDESTADDRREQ<o:p></o:p> |
Destination address required. <o:p></o:p> A required address was omitted from an operation on a socket. For example, this error will be returned if sendto is called with the remote address of ADDR_ANY. <o:p></o:p> |
10040<o:p></o:p> |
WSAEMSGSIZE<o:p></o:p> |
Message too long. <o:p></o:p> A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram into was smaller than the datagram itself. <o:p></o:p> |
10041<o:p></o:p> |
WSAEPROTOTYPE<o:p></o:p> |
Protocol wrong type for socket. <o:p></o:p> A protocol was specified in the socket function call that does not support the semantics of the socket type requested. For example, the ARPA Internet UDP protocol cannot be specified with a socket type of SOCK_STREAM. <o:p></o:p> |
10042<o:p></o:p> |
WSAENOPROTOOPT<o:p></o:p> |
Bad protocol option. <o:p></o:p> An unknown, invalid or unsupported option or level was specified in a getsockopt or setsockopt call.<o:p></o:p> |
10043<o:p></o:p> |
WSAEPROTONOSUPPORT<o:p></o:p> |
Protocol not supported. <o:p></o:p> The requested protocol has not been configured into the system, or no implementation for it exists. For example, a socket call requests a SOCK_DGRAM socket, but specifies a stream protocol. <o:p></o:p> |
10044<o:p></o:p> |
WSAESOCKTNOSUPPORT<o:p></o:p> |
Socket type not supported. <o:p></o:p> The support for the specified socket type does not exist in this address family. For example, the optional type SOCK_RAW might be selected in a socket call, and the implementation does not support SOCK_RAW sockets at all. <o:p></o:p> |
10045<o:p></o:p> |
WSAEOPNOTSUPP<o:p></o:p> |
Operation not supported. <o:p></o:p> The attempted operation is not supported for the type of object referenced. Usually this occurs when a socket descriptor to a socket that cannot support this operation, for example, trying to accept a connection on a datagram socket.<o:p></o:p> |
10046<o:p></o:p> |
WSAEPFNOSUPPORT<o:p></o:p> |
Protocol family not supported. <o:p></o:p> The protocol family has not been configured into the system or no implementation for it exists. Has a slightly different meaning to WSAEAFNOSUPPORT, but is interchangeable in most cases, and all Windows Sockets functions that return one of these specify WSAEAFNOSUPPORT. <o:p></o:p> |
10047<o:p></o:p> |
WSAEAFNOSUPPORT<o:p></o:p> |
Address family not supported by protocol family. <o:p></o:p> An address incompatible with the requested protocol was used. All sockets are created with an associated "address family" (i.e. AF_INET for Internet Protocols) and a generic protocol type (i.e. SOCK_STREAM). This error will be returned if an incorrect protocol is explicitly requested in the socket call, or if an address of the wrong family is used for a socket, e.g. in sendto. <o:p></o:p> |
10048<o:p></o:p> |
WSAEADDRINUSE<o:p></o:p> |
Address already in use. <o:p></o:p> Only one usage of each socket address (protocol/IP address/port) is normally permitted. This error occurs if an application attempts to bind a socket to an IP address/port that has already been used for an existing socket, or a socket that wasn't closed properly, or one that is still in the process of closing. For server applications that need to bind multiple sockets to the same port number, consider using setsockopt(SO_REUSEADDR). Client applications usually need not call bind at all - connect will choose an unused port automatically. When bind is called with a wild-card address (involving ADDR_ANY), a WSAEADDRINUSE error could be delayed until the specific address is "committed." This could happen with a call to other function later, including connect, listen, WSAConnect or WSAJoinLeaf.<o:p></o:p> |
10049<o:p></o:p> |
WSAEADDRNOTAVAIL<o:p></o:p> |
Cannot assign requested address. <o:p></o:p> The requested address is not valid in its context. Normally results from an attempt to bind to an address that is not valid for the local machine. This can also result from connect, sendto, WSAConnect, WSAJoinLeaf, or WSASendTo when the remote address or port is not valid for a remote machine (e.g. address or port 0). <o:p></o:p> <o:p> </o:p> |
10050<o:p></o:p> |
WSAENETDOWN<o:p></o:p> |
Network is down. <o:p></o:p> A socket operation encountered a dead network. This could indicate a serious failure of the network system (i.e. the protocol stack that the WinSock DLL runs over), the network interface, or the local network itself. <o:p></o:p> |
10051<o:p></o:p> |
WSAENETUNREACH<o:p></o:p> |
Network is unreachable. <o:p></o:p> A socket operation was attempted to an unreachable network. This usually means the local software knows no route to reach the remote host.<o:p></o:p> |
10052<o:p></o:p> |
WSAENETRESET<o:p></o:p> |
Network dropped connection on reset. <o:p></o:p> The connection has been broken due to "keep-alive" activity detecting a failure while the operation was in progress. It can also be returned by setsockopt if an attempt is made to set SO_KEEPALIVE on a connection that has already failed. <o:p></o:p> |
10053<o:p></o:p> |
WSAECONNABORTED<o:p></o:p> |
Software caused connection abort. <o:p></o:p> An established connection was aborted by the software in your host machine, possibly due to a data transmission timeout or protocol error. <o:p></o:p> |
10054<o:p></o:p> |
WSAECONNRESET<o:p></o:p> |
Connection reset by peer. <o:p></o:p> A existing connection was forcibly closed by the remote host. This normally results if the peer application on the remote host is suddenly stopped, the host is rebooted, or the remote host used a "hard close" (see setsockopt for more information on the SO_LINGER option on the remote socket.) This error may also result if a connection was broken due to "keep-alive" activity detecting a failure while one or more operations are in progress. Operations that were in progress fail with WSAENETRESET. Subsequent operations fail with WSAECONNRESET.<o:p></o:p> |
10055<o:p></o:p> |
WSAENOBUFS<o:p></o:p> |
No buffer space available. <o:p></o:p> An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full. <o:p></o:p> <o:p> </o:p> |
10056<o:p></o:p> |
WSAEISCONN<o:p></o:p> |
Socket is already connected. <o:p></o:p> A connect request was made on an already connected socket. Some implementations also return this error if sendto is called on a connected SOCK_DGRAM socket (For SOCK_STREAM sockets, the to parameter in sendto is ignored), although other implementations treat this as a legal occurrence. <o:p></o:p> |
10057<o:p></o:p> |
WSAENOTCONN<o:p></o:p> |
Socket is not connected. <o:p></o:p> A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using sendto) no address was supplied. Any other type of operation might also return this error - for example, setsoc |