Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

listen(2) [hpux man page]

listen(2)							System Calls Manual							 listen(2)

NAME
listen - listen for connections on a socket SYNOPSIS
DESCRIPTION
To accept connections, a socket is first created using a queue for incoming connections is activated using and then connections are accepted using 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 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 be bound to an address by using before connection establishment can continue, otherwise an 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 error. backlog is limited to the range of 0 to which is defined in is currently set to 4096. If any other value is specified, the system automat- ically assigns the closest value within the range. Note that for a backlog of 0 specifies only 1 pending connection is allowed at any given time. For a backlog of 0 specifies no further connection is allowed. X/Open Sockets Compilation Environment See xopen_networking(7). DEPENDENCIES
AF_CCITT Call-acceptance can be controlled by the call described in Upon successful completion, returns 0; otherwise, it returns -1 and sets to indicate the error. ERRORS
fails if any of the following conditions are encountered: s is not a valid file descriptor. The socket s has not been bound to an address by using s is a valid file descriptor but it is not a socket. The socket referenced by s does not support The socket has been shut down or is already connected. WARNINGS
Linking binary objects compiled to specification and binary objects compiled to specification to the same executable may result in unex- pected behavior, including application abnormal termination and unexpected socket errors. See xopen_networking(7) for details and remedy. FUTURE DIRECTION
Currently, the default behavior is the however, it might be changed to in a future release. At that time, any behavior that is incompati- ble with might be obsoleted. Applications that conform to the X/Open specification now will avoid migration problems (see xopen_network- ing(7)). AUTHOR
was developed by HP and the University of California, Berkeley. SEE ALSO
accept(2), connect(2), socket(2), thread_safety(5), xopen_networking(7), inet(7F). STANDARDS CONFORMANCE
listen(2)

Check Out this Related Man Page

listen(3XNET)					   X/Open Networking Services Library Functions 				     listen(3XNET)

NAME
listen - listen for socket connections and limit the queue of incoming connections SYNOPSIS
cc [ flag ... ] file ... -lxnet [ library ... ] #include <sys/socket.h> int listen(int socket, int backlog); DESCRIPTION
The listen() function marks a connection-mode socket, specified by the socket argument, as accepting connections, and limits the number of outstanding connections in the socket's listen queue to the value specified by the backlog argument. If listen() is called with a backlog argument value that is less than 0, the function sets the length of the socket's listen queue to 0. The implementation may include incomplete connections in the queue subject to the queue limit. The implementation may also increase the specified queue limit internally if it includes such incomplete connections in the queue subject to this limit. Implementations may limit the length of the socket's listen queue. If backlog exceeds the implementation-dependent maximum queue length, the length of the socket's listen queue will be set to the maximum supported value. The socket in use may require the process to have appropriate privileges to use the listen() function. RETURN VALUES
Upon successful completions, listen() returns 0. Otherwise, -1 is returned and errno is set to indicate the error. ERRORS
The listen() function will fail if: EBADF The socket argument is not a valid file descriptor. EDESTADDRREQ The socket is not bound to a local address, and the protocol does not support listening on an unbound socket. EINVAL The socket is already connected. ENOTSOCK The socket argument does not refer to a socket. EOPNOTSUPP The socket protocol does not support listen(). The listen() function may fail if: EACCES The calling process does not have the appropriate privileges. EINVAL The socket has been shut down. ENOBUFS Insufficient resources are available in the system to complete the call. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
accept(3XNET), connect(3XNET), socket(3XNET), attributes(5), standards(5) SunOS 5.11 10 Jun 2002 listen(3XNET)
Man Page