1LISTEN(2)                     System Calls Manual                    LISTEN(2)
2
3
4

NAME

6       listen - listen for connections on a socket
7

SYNOPSIS

9       listen(s, backlog)
10       int s, backlog;
11

DESCRIPTION

13       To  accept  connections,  a  socket  is first created with socket(2), a
14       willingness to accept incoming connections and a queue limit for incom‐
15       ing  connections are specified with listen(2), and then the connections
16       are accepted with accept(2).  The listen call applies only  to  sockets
17       of type SOCK_STREAM or SOCK_SEQPACKET.
18
19       The  backlog  parameter defines the maximum length the queue of pending
20       connections may grow to.  If a  connection  request  arrives  with  the
21       queue  full the client may receive an error with an indication of ECON‐
22       NREFUSED, or, if the underlying protocol supports  retransmission,  the
23       request may be ignored so that retries may succeed.
24

RETURN VALUE

26       A 0 return value indicates success; -1 indicates an error.
27

ERRORS

29       The call fails if:
30
31       [EBADF]             The argument s is not a valid descriptor.
32
33       [ENOTSOCK]          The argument s is not a socket.
34
35       [EOPNOTSUPP]        The socket is not of a type that supports the oper‐
36                           ation listen.
37

SEE ALSO

39       accept(2), connect(2), socket(2)
40

BUGS

42       The backlog is currently limited (silently) to 5.
43
44
45
464.2 Berkeley Distribution        May 14, 1986                        LISTEN(2)
Impressum