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(3SOCKET) 					     Sockets Library Functions						   listen(3SOCKET)

NAME
listen - listen for connections on a socket SYNOPSIS
cc [ flag ... ] file ... -lsocket -lnsl [ library ... ] #include <sys/types.h> #include <sys/socket.h> int listen(int s, int backlog); DESCRIPTION
To accept connections, a socket is first created with socket(3SOCKET), a backlog for incoming connections is specified with listen() and then the connections are accepted with accept(3SOCKET). The listen() call applies only to sockets of type SOCK_STREAM or SOCK_SEQPACKET. The backlog parameter defines the maximum length the queue of pending connections may grow to. If a connection request arrives with the queue full, the client will receive an error with an indication of ECONNREFUSED for AF_UNIX sock- ets. If the underlying protocol supports retransmission, the connection request may be ignored so that retries may succeed. For AF_INET and AF_INET6sockets, the TCP will retry the connection. If the backlog is not cleared by the time the tcp times out, the connect will fail with ETIMEDOUT. RETURN VALUES
A 0 return value indicates success; -1 indicates an error. ERRORS
The call fails if: EBADF The argument s is not a valid file descriptor. ENOTSOCK The argument s is not a socket. EOPNOTSUPP The socket is not of a type that supports the operation listen(). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ SEE ALSO
accept(3SOCKET), connect(3SOCKET), socket(3SOCKET), attributes(5), socket.h(3HEAD) NOTES
There is currently no backlog limit. SunOS 5.10 8 Nov 1999 listen(3SOCKET)
Man Page