windows socket error code and error cause -Windows Sockets error code extensions described(1)

Discussion in 'General Topics' started by ChoAnderson, Feb 24, 2014.

  1. ChoAnderson Administrator

    A.2 Windows Sockets error code extensions described
    Here are WSAGetLastError () function returns a list of possible error codes in alphabetical order , and gives a brief description of the expansion .
    WSAEACCES (10013) Permission denied.
    Attempting to access is forbidden to use to access the socket. For example , using the function sendto function is not used in the setsockopt () command to set the broadcast rights SO_BROADCAST socket ( ) to send data to a broadcast address .
    WSAEADDRINUSE (10048) Address already in use.
    Each socket address ( protocol / IP address / port ) is normally permitted only once . When an application attempts to use bind () or the socket is not fully closed or being closed is a function of the use of the existing IP address / port binding when a new socket to which the error occurred . For server applications, if you need to use the bind () function lashing multiple sockets to the same port, you can consider using setsockopt () SO_REUSEADDR command function. Client applications usually do not need to use the bind () function - connect () function does not always automatically select the port number used . When the bind () function is operated wildcard address ( including ADDR_ANY), an error occurred WSAEADDRINUSE may only be submitted to a definite address delay . This may occur when the subsequent functions such as connect (), listen (), WSAConnect () or WSAJoinLeaf () call.
    WSAEADDRNOTAVAIL (10049) Cannot assign requested address.
    Address is requested in its environment is not legitimate. Normally ( ) function when trying to generate a local machine is not legally binding addresses to sockets bind. It may also be in the connect (), sendto (), WSAConnect (), WSAJoinLeaf () or WSASendTo () function is called when the remote machine by remote address or port number of illegal ( eg 0 0 address or port number ) to produce .
    WSAEAFNOSUPPORT (10047) Address family not supported by protocol family.
    Address used is not compatible with the protocol being requested. When all the sockets are created with an address family ( eg IP protocol corresponding AF_INET) and a generic protocol type ( eg SOCK_STREAM) link. If explicitly requested socket () call in an incorrect protocol , or call sendto () and other functions when used for a socket address family is wrong address , the error is returned.
    WSAEALREADY (10037) Operation already in progress.
    When the non-blocking socket has an operation is in progress , another operation was attempted on the implementation of this error is generated . Such as: In an ongoing nonblocking socket connection first secondary call connect () function ; or cancel one that has been canceled or completed asynchronous request (WSAAsyncGetXbyY ()).
    WSAECONNABORTED (10053) Software caused connection abort.
    An established connection was aborted by the software in your host machine, possibly due to a data transmission timeout or protocol error.
    WSAECONNREFUSED (10061) Connection refused.
    Because the target machine actively refused the connection can not be established . This is usually because trying to connect to a remote host is not active service , if there is no server application is running.
    WSAECONNRESET (10054) Connection reset by peer.
    Existing connection forcibly closed by the remote host . Usually due to: the remote host peer applications suddenly stop running, or restart a remote host or a remote host on the remote socket using a " hard close" ( see setsockopt (SO_LINGER)). In addition, one or more operations are in progress , if the connection due to "keep-alive" activity detecting a failure while the interrupt , can also cause this error. At this time, the ongoing operation failed with error code returned WSAENETRESET, subsequent operations will fail to return an error code WSAECONNRESET.
    WSAEDESTADDRREQ (10039) Destination address required.
    An operation on a socket address must be missed. For example, if sendto () function is called with the remote address ADDR_ANY, this error is returned.
    WSAEFAULT (10014) Bad address.
    The system detects a call attempt to use a pointer parameter points to an invalid pointer address . If the application passes an invalid pointer value , or the length of the buffer is too small , this error occurs. For example, the parameters for the structure sockaddr, but the length parameter is less than sizeof (struct sockaddr).
    WSAEHOSTDOWN (10064) Host is down.
    A socket operation failed because the destination host was down to return . A socket operation encountered a dead host . Network activity on the local host is not initialized. These conditions indicate the error code WSAETIMEDOUT seems more appropriate.
    WSAEHOSTUNREACH (10065) No route to host.
    Tried an unreachable host socket operation . See WSAENETUNREACH.
    WSAEINPROGRESS (10036) Operation now in progress.
    A blocking operation is being performed. Windows Sockets only allows a task ( or thread ) at the same time blocking operation can not be completed , if any function call is made ( regardless of whether this function is a reference to the socket or any other socket ) , this function WSAEINPROGRESS will return an error code .
    WSAEINTR (10004) Interrupted function call.
    Blocking operation is a function WSACancelBlockingCall () call interrupted .
    WSAEINVAL (10022) Invalid argument.
    Providing illegal parameters ( for example , when using the setsockopt () function specifies an invalid level). In some instances, it may also be associated with the current state of the socket , for example, do not use the socket listen () so that it calls accept () function when in listening .
    WSAEISCONN (10056) Socket is already connected.
    Connection request occurs on an already connected socket . Some implementations use sendto on a connected SOCK_DGRAM socket ( ) function also returns this case the error ( for SOCK_STREAM sockets , to parameters sendto () function is ignored ) , although other implementations treat this as a legitimate events.
    WSAEMFILE (10024) Too many open files.
    Too many open sockets. Whether the entire system or for each process or thread , Windows Sockets implementation may have a maximum number of socket handles available .
    WSAEMSGSIZE (10040) Message too long.
    A message sent on a datagram socket is larger than the internal message buffer or some other network limit , or the buffer used to receive a datagram is smaller than the datagram itself .

Share This Page