Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ Intro(SSC) — OpenDesktop Software Development System 3.0.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

Intro(S)

perror(S)


 Intro(SSC)                     6 January 1993                     Intro(SSC)


 Name

    Intro - introduction to socket system calls and error numbers

 Syntax


    #include <sys/errno.h>


 Description

    This section describes all of the socket system calls used in SCO UNIX.
    All of these system calls are accessible from the socket library, lib-
    socket.  The link editor ld(CP) and the C compiler cc(CP) search this
    library when the -lsocket option is specified.  Most of these calls have
    one or more error returns, and some of the error codes are socket
    specfic. An error condition is indicated by an otherwise impossible
    return value.  This is almost always -1; the individual descriptions
    specify the details.  Note that a number of system calls overload the
    meanings of these error numbers, and that the meanings must be inter-
    preted according to the type and circumstances of the call.

    As with normal arguments, all return codes and values from functions are
    of type integer unless otherwise noted.  An error number is also made
    available in the external variable errno, which is not cleared on suc-
    cessful calls.  Thus errno should be tested only after an error has
    occurred.

    The following is a complete list of the socket errors and their names as
    given in <sys/errno.h>.  See Intro(S) for a more comprehensive list of
    error codes.

    63         ENOBUFS  No buffer space available
       An operation on a socket or pipe was not performed because the system
       lacked sufficient buffer space or because a queue was full.  ENOBUFS
       is defined to have the same value as ENOSR.

    90         TCPERR
       The starting value of socket related error codes.

    TCPERR+0   EWOULDBLOCK  Operation would block
       An operation that would cause a process to block was attempted on an
       object in non-blocking mode (see fcntl(SSC)).

    TCPERR+1   EINPROGRESS  Operation now in progress
       An operation that takes a long time to complete (such as a
       connect(SSC)) was attempted on a non-blocking object (see fcntl(SSC)).

    TCPERR+2   EALREADY  Operation already in progress
       An operation was attempted on a non-blocking object that already had
       an operation in progress.

    TCPERR+3   ENOTSOCK  Socket operation on non-socket
       Self-explanatory.

    TCPERR+4   EDESTADDRREQ  Destination address required
       A required address was omitted from an operation on a socket.

    TCPERR+5   EMSGSIZE  Message too long
       A message sent on a socket was larger than the internal message buffer
       or some other network limit.

    TCPERR+6   EPROTOTYPE  Protocol wrong type for socket
       A protocol was specified that does not support the semantics of the
       socket type requested. For example, you cannot use the ARPA Internet
       UDP protocol with type SOCKSTREAM.

    TCPERR+7   EPROTONOSUPPORT  Protocol not supported
       The protocol has not been configured into the system or no implementa-
       tion for it exists.

    TCPERR+8   ESOCKTNOSUPPORT  Socket type not supported
       The support for the socket type has not been configured into the sys-
       tem or no implementation for it exists.

    TCPERR+9   EOPNOTSUPP  Operation not supported on socket
       For example, trying to accept a connection on a datagram socket.

    TCPERR+10  EPFNOSUPPORT  Protocol family not supported
       The protocol family has not been configured into the system or no
       implementation for it exists.

    TCPERR+11  EAFNOSUPPORT  Address family not supported by protocol family
       An address incompatible with the requested protocol was used.  For
       example, you shouldn't necessarily expect to be able to useNS
       addresses with ARPA Internet protocols.

    TCPERR+12  EADDRINUSE  Address already in use
       Only one usage of each address is normally permitted.

    TCPERR+13  EADDRNOTAVAIL  Can't assign requested address
       Normally results from an attempt to create a socket with an address
       not on this machine.

    TCPERR+14  ENETDOWN  Network is down
       A socket operation encountered a dead network.

    TCPERR+15  ENETUNREACH  Network is unreachable
       A socket operation was attempted to an unreachable network.

    TCPERR+16  ENETRESET  Network dropped connection on reset
       The host you were connected to crashed and rebooted.

    TCPERR+17  ECONNABORTED  Software caused connection abort
       A connection abort was caused internal to your host machine.

    TCPERR+18  ECONNRESET  Connection reset by peer
       A connection was forcibly closed by a peer.  This normally results
       from a loss of the connection on the remote socket due to a timeout or
       a reboot.

    TCPERR+19  unused

    TCPERR+20  EISCONN  Socket is already connected
       A connect request was made on an already connected socket; or, a
       sendto or sendmsg request on a connected socket specified a destina-
       tion when already connected.

    TCPERR+21  ENOTCONN  Socket is not connected
       An request to send or receive data was disallowed because the socket
       is not connected and (when sending on a  datagram socket) no address
       was supplied.

    TCPERR+22  ESHUTDOWN  Can't send after socket shutdown
       A request to send data was disallowed because the socket had already
       been shut down with a previous shutdown(SSC) call.

    TCPERR+23  unused

    TCPERR+24  ETIMEDOUT  Connection timed out
       A connect or send request failed because the connected party did not
       properly respond after a period of time.  (The timeout period is
       dependent on the communication protocol.)

    TCPERR+25  ECONNREFUSED  Connection refused
       No connection could be made because the target machine actively
       refused it.  This usually results from trying to connect to a service
       that is inactive on the foreign host.

    TCPERR+26  EHOSTDOWN  Host is down
       A socket operation failed because the destination host was down.

    TCPERR+27  EHOSTUNREACH  Host is unreachable
       A socket operation was attempted to an unreachable host.

    TCPERR+28  ENOPROTOOPT  Option not supported by protocol
       A bad option or level was specified in a getsockopt(SSC) or
       setsockopt(SSC) call.

 Files

    /usr/lib/libsocket.a

 Definitions


    Socket Descriptor

         An integer assigned by the system when a socket is referenced by
         dup(S), or when a socket is created by socket(SSC), which uniquely
         identifies an access path to that socket from a given process or any
         of its children.

    Sockets and Address Families

         A socket is an endpoint for communication between processes.  Each
         socket has queues for sending and receiving data.

         Sockets are typed according to their communications properties.
         These properties include whether messages sent and received at a
         socket require the name of the partner, whether communication is
         reliable, the format used in naming message recipients, etc.

         Each instance of the system supports some collection of socket
         types; consult socket(SSC) for more information about the types
         available and their properties.

         Each instance of the system supports some number of sets of communi-
         cations protocols.  Each protocol set supports addresses of a cer-
         tain format.  An Address Family is the set of addresses for a spe-
         cific group of protocols.  Each socket has an address chosen from
         the address family in which the socket was created.

 List of functions


    __________________________________________________________________________
    Name        Appears on Page     Description
    __________________________________________________________________________
    accept       accept(SSC)        accept a connection on a socket
    adjtime      adjtime(SSC)       correct system time to network average
    bind         bind(SSC)          bind a name to a socket
    connect      connect(SSC)       initiate a connection on a socket
    getpeername  getpeername(SSC)   get name of connected peer
    getsockname  getsockname(SSC)   get socket name
    getsockopt   getsockopt(SSC)    get options on sockets
    gettimeofday gettimeofday(SSC)  get date and time


    listen       listen(SSC)        listen for connections on a socket
    recv         recv(SSC)          receive a message from a connected socket
    recvfrom     recv(SSC)          receive a message from a socket
    send         send(SSC)          send a message to a connected socket
    sendto       send(SSC)          send a message to a socket
    setsockopt   getsockopt(SSC)    set options on sockets
    settimeofday gettimeofday(SSC)  set date and time
    shutdown     shutdown(SSC)      shut down part of a full-duplex connection
    socket       socket(SSC)        create an endpoint for communication


 See also

    Intro(S) and perror(S).


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026