Chapter 7, Developing applications over TCP/IP using Internet sockets
List of error codes (Internet domain)

List of error codes (Internet domain)

In the following list of networking error codes, the protocol or operation during which the error is likely to occur is given at the beginning of the explanation.


NOTE: If a connection fails at any time, the socket cannot be re-used; it must be closed and a new socket created.

I/O errors

 -------------------------------------------------------------------
 Error Name     Description                     Explanation
 -------------------------------------------------------------------
 EALREADY       Operation already in progress
 -------------------------------------------------------------------
 EINPROGRESS    Operation now in progress
 -------------------------------------------------------------------
 EWOULDBLOCK    Operation would block
 -------------------------------------------------------------------

Argument errors

 --------------------------------------------------------
 Error Name        Description       Explanation
 --------------------------------------------------------
 EADDRINUSE        Address already   TCP and UDP.  An
                   in use            attempt was made to
                                     create a socket with
                                     a port which has
                                     already been
                                     allocated.
 --------------------------------------------------------
 EADDRNOTAVAIL     Can't assign      TCP and UDP.  An
                   requested         attempt was made to
                   address           create a socket with
                                     a network address
                                     for which no network
                                     interface exists.
 --------------------------------------------------------
 EAFNOSUPPORT      Address family
                   not supported
                   by protocol
                   family
 --------------------------------------------------------
 EDESTADDRREQ      Destination
                   address
                   required
 --------------------------------------------------------
 EMSGSIZE          Message too
                   long
 --------------------------------------------------------
 ENOTSOCK          Socket
                   operation on
                   non-socket
 --------------------------------------------------------
 EOPNOTSUPP        Operation not
                   supported on
                   socket
 --------------------------------------------------------
 EPFNOSUPPORT      Protocol family
                   not supported
 --------------------------------------------------------
 EPROTONOSUPPORT   Protocol not      Creating a socket.
                   supported         Unknown protocol or
                                     protocol not
                                     supported.
 --------------------------------------------------------
 EPROTOTYPE        Protocol wrong    Creating a socket.
                   type for socket   Socket type request
                                     has no supporting
                                     protocol.
 --------------------------------------------------------
 ESOCKTNOSUPPORT   Socket type not
                   supported
 --------------------------------------------------------

Operational errors

 -----------------------------------------------------
 Error Name     Description       Explanation
 -----------------------------------------------------
 ECONNABORTED   Software caused
                connection
                abort
 -----------------------------------------------------
 ECONNREFUSED   Connection        Socket connection.
                refused           The host refused
                                  service for some
                                  reason.  This error
                                  is usually caused by
                                  a server process not
                                  being present at the
                                  requested name.
 -----------------------------------------------------
 ECONNRESET     Connection        TCP.  The remote
                reset by peer     peer forced the
                                  session to be
                                  closed.
 -----------------------------------------------------
 EISCONN        Socket is         IP and UDP.  An
                already           attempt was made to
                connected         establish a
                                  connection on a
                                  socket that already
                                  has one or an
                                  attempt was made to
                                  send a datagram with
                                  the destination
                                  address specified
                                  and the socket is
                                  already connected.
                                  TCP.  An attempt was
                                  made to establish a
                                  connection on a
                                  socket that already
                                  has one.
 -----------------------------------------------------
 ENETDOWN       Network is down   Socket connection.
                                  Status information
                                  received by the
                                  client host from the
                                  underlying
                                  communication
                                  services indicates
                                  the net or the
                                  remote host is down.
 -----------------------------------------------------
 ENETRESET      Network dropped
                connection on
                reset
 -----------------------------------------------------
 ENETUNREACH    Network is
                unreachable
 -----------------------------------------------------
 ENOBUFS        No buffer space   TCP, IP, and UDP.
                available         Any Socket
                                  Operation.  The
                                  system lacks
                                  sufficient memory
                                  for an internal data
                                  structure.
 -----------------------------------------------------
 ENOTCONN       Socket is not     UDP.  An attempt was
                connected         made to send a
                                  datagram, but no
                                  destination address
                                  is specified, and
                                  the socket has not
                                  been connected.
 -----------------------------------------------------
 ESHUTDOWN      Cannot send
                after socket
                shutdown
 -----------------------------------------------------
 ETIMEDOUT      Connection        Socket connection.
                timed out         After failing to
                                  establish a
                                  connection during a
                                  period of time
                                  (excessive
                                  retransmissions),
                                  the system decided
                                  there was no point
                                  in retrying any
                                  more.  The cause for
                                  this error is
                                  usually that the
                                  remote host is down
                                  or that problems in
                                  the network resulted
                                  in transmissions
                                  being lost.
 -----------------------------------------------------

Miscellaneous errors

 -----------------------------------------------------
 Error Name     Description       Explanation
 -----------------------------------------------------
 EHOSTDOWN      Host is down      Socket connection.
                                  Status information
                                  received by the
                                  client host from the
                                  underlying
                                  communication
                                  services indicates
                                  the net or the
                                  remote host is down.
 -----------------------------------------------------
 EHOSTUNREACH   No route to       Socket connection.
                host              These operational
                                  errors can occur
                                  either because the
                                  network or host is
                                  unknown (no route to
                                  the host or network
                                  is present) or
                                  because status
                                  information to that
                                  effect has been
                                  delivered to the
                                  client host by the
                                  underlying
                                  communication
                                  services.
 -----------------------------------------------------
 ENOPROTOOPT    Protocol not
                available
 -----------------------------------------------------