HPUX listen[2]






 listen(2)                                                         listen(2)





 NAME
      listen - listen for connections on a socket

 SYNOPSIS
      int listen(int s, int backlog);

 DESCRIPTION
      To accept connections, a socket is first created using socket(), a
      queue for incoming connections is specified using listen(), and then
      connections are accepted using accept().  listen() applies only to
      unconnected sockets of type SOCK_STREAM.  If the socket has not been
      bound to a local port before listen() is invoked, the system
      automatically binds a local port for the socket to listen on (see
      inet(7F)).  For sockets in the address family AF_CCITT, the socket
      must be bound to an address by using bind() before connection
      establishment can continue, otherwise an EADDREQUIRED error is
      returned.

      The listen queue is established for the socket specified by the s
      parameter, which is a socket descriptor.

      backlog defines the maximum allowable length of the queue for pending
      connections.  If a connection request arrives when the queue is full,
      the client receives an ETIMEDOUT error.

      backlog is currently limited (silently) to be in the range of 1 to 20.
      If any other value is specified, the system automatically assigns the
      closest value within range.

 DEPENDENCIES
    AF_CCITT:
      Call-acceptance can be controlled by the X25_CALL_ACPT_APPROVAL
      ioctl() call described in RETURN VALUE Upon successful completion,
      listen() returns 0; otherwise, it returns -1 and sets errno to
      indicate the error.

 ERRORS
      listen() fails if any of the following conditions are encountered:

           [EBADF]             The argument s is not a valid descriptor.

           [EDESTADRREQ]       No bind address was established.

           [ENOTSOCK]          The argument s is not a socket.

           [EOPNOTSUPP]        The socket is not of a type that supports the
                               listen() operation.

           [ENOBUFS]           (Series 300/400 only) No buffer space is
                               available.  listen() cannot be started at
                               this time.



 Hewlett-Packard Company            - 1 -     HP-UX Release 9.0: August 1992






 listen(2)                                                         listen(2)





           [EINVAL]            The socket has been shut down or is already
                               connected (see socketx25(7)).

 AUTHOR
      listen() was developed by the University of California, Berkeley.

 SEE ALSO
      accept(2), connect(2), socket(2), socketx25(7), af_ccitt(7F),
      inet(7F).













































 Hewlett-Packard Company            - 2 -     HP-UX Release 9.0: August 1992