Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ listen(2) — HP-UX 8.07

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

accept(2)

connect(2)

socket(2)

socketx25(7)

af_ccitt(7F)

inet(7F)

listen(2)

Requires Optional LAN/X.25 Software

NAME

listen − listen for connections on a socket

SYNOPSIS

int listen(int s, int backlog);

DESCRIPTION

To accept connections, a socket is first created with socket(2), a queue for incoming connections is specified with listen(2) and then connections are accepted with accept(2). 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 with 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 you specify any other value, 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 If the call is successful, 0 is returned.  If the call fails, −1 is returned and an error code is stored in errno. 

DIAGNOSTICS

listen fails if:

[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. 

[EINVAL] The socket has been shut down or is already connected.  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  —  HP-UX Release 8.05: June 1991

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