*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->HP-UX 11i man pages -> listen (2)              
Title
Content
Arch
Section
 

Contents


 listen(2)                                                         listen(2)




 NAME    [Toc]    [Back]
      listen - listen for connections on a socket

 SYNOPSIS    [Toc]    [Back]
      #include <sys/socket.h>

      int listen(int s, int backlog);

 DESCRIPTION    [Toc]    [Back]
      To accept connections, a socket is first created using socket(), a
      queue for incoming connections is activated using listen(), and then
      connections are accepted using accept().  listen() applies only to
      unconnected sockets of type SOCK_STREAM.  Except for AF_VME_LINK, 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
      and AF_VME_LINK, the socket must be bound to an address by using
      bind() before connection establishment can continue, otherwise an
      EADDREQUIRED error is returned.

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

      backlog defines the desirable queue length for pending connections.
      The actual queue length may be greater than the specified backlog.  If
      a connection request arrives when the queue is full, the client will
      receive an ETIMEDOUT error.

      backlog is limited to the range of 0 to SOMAXCONN, which is defined in
      <sys/socket.h>.  SOMAXCONN is currently set to 4096.  If any other
      value is specified, the system automatically assigns the closest value
      within the range.  A backlog of 0 specifies only 1 pending connection
      is allowed at any given time.

 DEPENDENCIES    [Toc]    [Back]
    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    [Toc]    [Back]
      listen() fails if any of the following conditions are encountered:

           [EBADF]             s is not a valid file descriptor.

           [EDESTADDRREQ]      The socket s has not been bound to an address
                               by using bind().

           [ENOTSOCK]          s is a valid file descriptor but it is not a
                               socket.



 Hewlett-Packard Company            - 1 -   HP-UX 11i Version 2: August 2003






 listen(2)                                                         listen(2)




           [EOPNOTSUPP]        The socket referenced by s does not support
                               listen().

           [EINVAL]            The socket has been shut down or is already
                               connected.

 FUTURE DIRECTION    [Toc]    [Back]
      Currently, the default behavior is the HP-UX BSD Sockets; however, it
      might be changed to X/Open Sockets in a future release.  At that time,
      any HP-UX BSD Sockets behavior that is incompatible with X/Open
      Sockets might be obsoleted.  Applications that conform to the X/Open
      specification now will avoid migration problems (see
      xopen_networking(7)).

 AUTHOR    [Toc]    [Back]
      listen() was developed by HP and the University of California,
      Berkeley.

 SEE ALSO    [Toc]    [Back]
      accept(2), connect(2), socket(2), thread_safety(5),
      xopen_networking(7), inet(7F).

 STANDARDS CONFORMANCE    [Toc]    [Back]
      listen(): XPG4


 Hewlett-Packard Company            - 2 -   HP-UX 11i Version 2: August 2003
[ Back ]
      
      
 Similar pages
Name OS Title
listen Tru64 Listen for socket connections and limits the backlog of incoming connections
netstat Linux Print network connections, routing tables, interface statistics, masquerade connections, and multica...
mac_get FreeBSD get the label of a file, socket, socket peer or process
mac_get_proc FreeBSD get the label of a file, socket, socket peer or process
mac_get_fd FreeBSD get the label of a file, socket, socket peer or process
mac_get_file FreeBSD get the label of a file, socket, socket peer or process
mac_get_pid FreeBSD get the label of a file, socket, socket peer or process
t_listen Tru64 Listen for a connect request
t_listen IRIX listen for a connect request
t_listen HP-UX listen for a connect request
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service