LISTEN(2) BSD Programmer's Manual LISTEN(2) NNAAMMEE lliisstteenn - listen for connections on a socket SSYYNNOOPPSSIISS ##iinncclluuddee <<ssyyss//ssoocckkeett..hh>> _i_n_t lliisstteenn(_i_n_t _s, _i_n_t _b_a_c_k_l_o_g); DDEESSCCRRIIPPTTIIOONN To accept connections, a socket is first created with socket(2), a will- ingness to accept incoming connections and a queue limit for incoming connections are specified with lliisstteenn(), and then the connections are ac- cepted with accept(2). The lliisstteenn() 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 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. RREETTUURRNN VVAALLUUEESS A 0 return value indicates success; -1 indicates an error. EERRRROORRSS LLiisstteenn(_w_i_l_l, _f_a_i_l, _i_f_:) [EBADF] The argument _s is not a valid descriptor. [ENOTSOCK] The argument _s is not a socket. [EOPNOTSUPP] The socket is not of a type that supports the operation lliisstteenn(). SSEEEE AALLSSOO accept(2), connect(2), socket(2) BBUUGGSS The _b_a_c_k_l_o_g is currently limited (silently) to 5. HHIISSTTOORRYY The lliisstteenn function call appeared in 4.2BSD. 4.2 Berkeley Distribution June 4, 1993 1