Sockets Library Functions listen(3SOCKET) NAME listen - listen for connections on a socket SYNOPSIS cc [ _f_l_a_g ... ] _f_i_l_e ... -lsocket -lnsl [ _l_i_b_r_a_r_y ... ] #include #include int listen(int _s, int _b_a_c_k_l_o_g); 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 _b_a_c_k_l_o_g 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 ECONNRE- FUSED for AF_UNIX sockets. If the underlying protocol sup- ports 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 _b_a_c_k_l_o_g 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 opera- tion listen(). ATTRIBUTES See attributes(5) for descriptions of the following attri- butes: SunOS 5.9 Last change: 8 Nov 1999 1 Sockets Library Functions listen(3SOCKET) ____________________________________________________________ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | |______________________________|______________________________| | MT-Level | Safe | |______________________________|______________________________| SEE ALSO accept(3SOCKET), connect(3SOCKET), socket(3SOCKET), attri- butes(5), socket(3HEAD) NOTES There is currently no _b_a_c_k_l_o_g limit. SunOS 5.9 Last change: 8 Nov 1999 2