An error is returned if the connection is unsuccessful (however, an address bound by the system remains). Otherwise, the socket is associated with the server and data transfer can begin.
Table 2-2 lists some of the more common errors returned when a connection attempt fails.
Table 2-2 Socket Connection Errors
Socket Errors |
Error Description |
---|---|
ENOBUFS |
Lack of memory available to support the call. |
EPROTONOSUPPORT |
Request for an unknown protocol. |
EPROTOTYPE |
Request for an unsupported type of socket. |
ETIMEDOUT |
No connection established in specified time. This happens when the destination host is down or when problems in the network result in lost transmissions. |
ECONNREFUSED |
The host refused service. This happens when a server process is not present at the requested address. |
ENETDOWN or EHOSTDOWN |
These errors are caused by status information delivered by the underlying communication interface. |
ENETUNREACH or EHOSTUNREACH |
These operational errors can occur either because there is no route to the network or host, or because of status information returned by intermediate gateways or switching nodes. The status returned is not always sufficient to distinguish between a network that is down and a host that is down. |