LISTEN(2,L) AIX Technical Reference LISTEN(2,L) ------------------------------------------------------------------------------- listen PURPOSE Listens for connections on a socket. LIBRARY Internet Library (libc.a) SYNTAX int listen (s, backlog) int s, backlog; DESCRIPTION To accept connections, create a socket with socket, specify a backlog for incoming connections with listen, and accept the connections with accept. The listen system call applies only to sockets of type SOCK_STREAM. The backlog parameter defines the maximum length for the queue of pending connections. The maximum value of the backlog parameter is 5. If a connection request arrives with the queue full, the client may receive an error with an indication of ECONNREFUSED, or, if the underlying protocol supports retransmission, the request may be ignored so that retries may succeed. RETURN VALUE Upon successful completion, a value of 0 is returned. If the listen system call fails, a value of -1 is returned, and errno is set to indicate the error. ERROR CONDITIONS The system call fails if one or more of the following are true: EBADF The s parameter is not valid. ENOTSOCK The s parameter refers to a file, not a socket. EOPNOTSUPP The referenced socket is not of type that supports listen. EINVAL The referenced socket refers to a NULL inode. RELATED INFORMATION In this book: "accept," "connect," and "socket." Processed November 7, 1990 LISTEN(2,L) 1