Tuesday, July 24, 2012

Winsock error value description




This is in winsock.h

# Define WSABASEERR 10000

# Define WSAEINTR (WSABASEERR +4)

# Define WSAEBADF (WSABASEERR +9)

# Define WSAEACCES (WSABASEERR +13)

# Define WSAEFAULT (WSABASEERR +14)

# Define WSAEINVAL (WSABASEERR +22)

# Define WSAEMFILE (WSABASEERR +24)

. . . . .

This has been rough. Note was also re-organized into a chart. Later, when programming with sockets sockets if an error occurs the error function

After obtaining the code, depending on the function fails, the error code to determine the cause will be haebomyeon

Socket for each function when an error occurs, -1 is returned if the Unix Winsock or the INVALID_SOCKET SOCKET_ERROR is returned. Socket must
If the number of functions to get a handle value INVALID_SOCKET error should be compared with the other as a normal socket functions test SOCKET_ERROR
Is when. Where success or simply a function silpaenya If you get ten thousand programmers are considerably harder to catch errors in position.

So exactly what is causing the socket function, whether they give point. So those kinds of errors pre-defined numeric value is haenotgo finish.
In the event of an error gives the error code returned. What is the global variable errno to Unix sockets filled with the error code and variables
Winsock the WSAGetLastError () function call can not tell you. Consider the following code


First, the only way to get over a Unix socket
int sock;

/ / Returns -1 if it fails to obtain
sock = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (socket <0) {printf ("socket () Error .. -> Error Code% d", errno);
}

, And the Winsock

SOCKET sock;

/ / If it fails to obtain returns INVALIDE_SOCKET
sock = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (socket == INVALID_SOCKET)
{
printf ("socket () Error .. Error -> Code% d", WSAGetLastError ());
}

Windows socket error Value Description

WSAEINTR 10004

This Winsock WSACancelBlockingCall blocking the function has been canceled


WSAEBADF 10009

Invalid descriptor (socket handle) is


WSAEACCES 10013

Broadcast address of a datagram socket for the connection attempt has not been set SO_BROADCAST setsockopt function failed in the state.


WSAEFAULT 10014

The name or namelen parameter is not the correct type.


WSAEINVAL 10022

Before you accept the listen function was not called.


WSAEMFILE 10024

Assigned to the new socket descriptor for the socket does not stay longer

WSAEWOULDBLOCK 10035

Socket function is bibeulreokking mode operation

WSAEINPROGRESS 10036

Blocking the function is called, the function was called while the socket inappropriate

WSAEALREADY 10037

Already completed the attempted cancellation for asynchronous command


WSAENOTSOCK 10038

Descriptor is a socket descriptor is not specified


WSAEDESTADDRREQ 10039

Destination address of the function is required but has not been provided


WSAEMSGSIZE 10040

Received messages stored in the buffers are too large to have been lost


WSAEPROTOTYPE 10041

The protocol specified is invalid or is the wrong type for this socket.


WSAENOPROTOOPT 10042

Unknown option, or does not support option was used.


WSAEPROTONOSUPPORT 10043

The specified protocol is an unsupported format



WSAESOCKTNOSUPPORT 10044

Address specified in the system specified socket type is unsupported format


WSAEOPNOTSUPP 10045

socket is yeongyeoljihyanghyeong service (SOCK_STREAM) is not the form. ex) listen at two UDP socket calls



WSAEPFNOSUPPORT 10046

The specified protocol scheme (PF_ *) is not supported



WSAEAFNOSUPPORT 10047

System specified address (AF_ *) is not supported



WSAEADDRINUSE 10048

The specified address (IP) is already in use



WSAEADDRNOTAVAIL 10049

The address specified on the local machine can not be used



WSAENETDOWN 10050

The network subsystem has encountered an error



WSAENETUNREACH 10051

Network to the remote system can not reach



WSAENETRESET 10052

Cut off during the connection operation is in progress covering.



WSAECONNABORTED 10053

Out-of-band connection failure or other covering, so broken.



WSAECONNRESET 10054

In a remote connection support "hard" or "abortive" has been reset by performing a shutdown.



WSAENOBUFS 10055

Windows Sockets insufficient buffer space of the system or application provided by the API space is too small to store the information requested not being able to



WSAEISCONN 10056

In the specified socket is already connected



WSAENOTCONN 10057

Not specified socket is already connected



WSASHUTDOWN 10058

Socket shutdown (shutdown ()) has been



WSAETOOMANYREFS 10059

Too many arguments specified for the function



WSAETIMEDOUT 10060

The attempt to connect timed out.



WSAECONNREFUSED 10061

The attempt to connect was forcefully terminated



WSAELOOP 10062



WSAENAMETOOLONG 10063



WSAEHOSTDOWN 10064

Was a remote host is down



WSAHOSTUNREACH 10065

By the remote host, network, system failures, etc. can not even months.


WSASYSNOTREADY 10091

Communicate with the network subsystem is not ready yet (WSAStartup () returns)


WSAVERNOTSUPPORTED 10092

Windows Sockets Windows Sockets version requested is currently not supported by your system.


WSANOTINITIALISED 10093

Before using this function call was successful WSAStartup.


WSAHOST_NOT_FOUND 11001

Can not find the host.


WSATRY_AGAIN 11002

Information requested is not found



WSANO_RECOVERY 11003

Unrecoverable error


WSANO_DATA 11004

The wrong name (name) as no data are not recorded.

No comments:

Post a Comment