[Post] explanation of common network error codes

Source: Internet
Author: User
Tags connection reset
Wsaeacces (10013) Permission denied.

Try to access the socket with the forbidden access permission. For example, the sendto () function is used to send data to a broadcast address on a socket that does not use the so_broadcast command of setsockopt () to set the broadcast permission.

Wsaeaddrinuse (10048) address already in use.

Under normal circumstances, each socket address (Protocol/IP Address/port number) can be used only once. When an application attempts to use the BIND () function to bind an existing or not fully closed or closed socket to a new socket, this error occurs. For server applications, if you need to use the BIND () function to bind multiple sockets to the same port, you can use the so_reuseaddr command of the setsockopt () function. Generally, customer applications do not need to use the BIND () function -- connect () function to automatically select unused port numbers. When the BIND () function operates on a wildcard address (including addr_any), the error wsaeaddrinuse may be delayed until a specific address is submitted. This may occur when subsequent functions such as connect (), listen (), wsaconnect (), or wsajoinleaf () are called.

Wsaeaddrnotavail (10049) cannot assign requested address.

The requested address is invalid in its environment. Usually this is generated when the BIND () function tries to bind an Invalid Address of a local machine to a socket. It may also be in connect (), sendto (), wsaconnect (), wsajoinleaf (), or wsasendto () the function is called because the remote address or port number of the remote machine is invalid (for example, 0 address or 0 port number.

Wsaeafnosupport (10047) address family not supported by protocol family.

The address used is not compatible with the requested protocol. All sockets are associated with an address family (such as af_inet corresponding to the IP protocol) and a common protocol type (such as sock_stream) when they are created. If an incorrect protocol is explicitly required in the socket () call, or the address of the address family that is incorrect for the socket is used when calling functions such as sendto, this error is returned.

Wsaealready (10037) operation already in progress.

This error occurs when an operation is ongoing on a non-blocking socket and another operation is attempted to be executed on it. For example, call the connect () function twice in a non-blocking socket that is being connected; or cancel a canceled or completed asynchronous request (wsaasyncgetxbyy ()).

Wsaeconnaborted (10053) software caused connection abort.

An established connection is terminated by software on your host, probably because of a data transmission timeout or protocol error.

Wsaeconnrefused (10061) connection refused.

The connection cannot be established because the target host is rejected. This is usually because you try to connect to a service that is not active on a remote host, such as no server application being executed.

Wsaeconnreset (10054) Connection reset by peer.

The existing connection is forcibly disabled by the remote host. The common cause is that the peer application on the remote host suddenly stops running or the remote host restarts, or the remote host uses "force" to disable the remote socket (see setsockopt (so_linger )). In addition, if the connection is interrupted due to a failure detected by the "keep-alive" activity during one or more operations, this error may also occur. At this time, the ongoing operation is returned with the error code wsaenetreset failed, and the error code wsaeconnreset will be returned for subsequent operations.

Wsaedestaddrreq (10039) Destination Address required.

The address required for an operation on the socket is omitted. For example, if the sendto () function is called and the remote address is addr_any, this error is returned.

Wsaefault (10014) bad address.

The system detects that a pointer parameter used by a call attempts to point to an invalid pointer address. This error occurs if the application passes an Invalid Pointer value or the buffer length is too small. For example, the parameter is a ADDR structure, but the length of the parameter is smaller than sizeof (struct sockaddr ).

Wsaehostdown (10064) host is down.

The socket operation fails to return because the target host is closed. The socket operation encounters an inactive host. Network activity on the local host is not initialized. These conditions are indicated by the error code wsaetimedout.

Wsaehostunreach (10065) No route to host.

Attempts to perform socket operations with an inaccessible host. See wsaenetunreach.

Wsaeinprogress (10036) operation now in progress.

A blocking operation is being executed. Windows Sockets only allows one task (or thread) to have one unfinished blocking operation at the same time, if any function is called at this time (whether or not the socket or any other socket is referenced by this function), this function will return the error code wsaeinprogress.

Wsaeintr (10004) interrupted function call.

The blocking operation is interrupted by the wsacancelblockingcall () function.

Wsaeinval (10022) invalid argument.

Invalid parameters are provided (for example, an invalid level is specified when setsockopt () function is used ). In some instances, it may also be related to the current status of the socket. For example, the accept () function is called when the socket does not use listen () to make it listen.

Wsaeisconn (10056) socket is already connected.

The connection request occurs on the connected socket. Some implementations also return this error when using the sendto () function on a socket connected to sock_dgram (for sock_stream socket, The to parameter of the sendto () function is ignored ), although some other implementations regard this operation as a legal event.

Wsaemfile (10024) Too program open files.

Too many sockets are opened. Whether it is for the entire system or every process or thread, the Windows Sockets implementation may have a maximum number of available socket handles.

Wsaemsgsize (10040) message too long.

A message sent on a datagram socket is greater than the internal message buffer or some other network restrictions, or the buffer used to accept the datagram is smaller than the datagram itself.

Wsaenetdown (10050) network is down.

A socket operation encounters an inactive network. This error may indicate a serious failure in the network system (such as the protocol stack for running Winsock DLL), network interface, or local network itself.

Wsaenetreset (10052) network dropped connection on reset.

When the operation is ongoing, the connection is interrupted because "keep-alive" detects a failure. It may also be returned by the setsockopt () function. If you try to use it to set so_keepalive on a failed connection.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.