Commit | Line | Data |
---|---|---|
bd121f65 C |
1 | .TH LISTEN 2 "12 February 1983" |
2 | .UC 4 | |
3 | .SH NAME | |
4 | listen \- listen for connections on a socket | |
5 | .SH SYNOPSIS | |
6 | .nf | |
7 | .ft B | |
8 | listen(s, backlog) | |
9 | int s, backlog; | |
10 | .fi | |
11 | .SH DESCRIPTION | |
12 | To accept connections, a socket | |
13 | is first created with | |
14 | .IR socket (2), | |
15 | a backlog for incoming connections is specified with | |
16 | .IR listen (2) | |
17 | and then the connections are | |
18 | accepted with | |
19 | .IR accept (2). | |
20 | The | |
21 | .I listen | |
22 | call applies only to sockets of type | |
23 | SOCK_STREAM | |
24 | or | |
25 | SOCK_PKTSTREAM. | |
26 | .PP | |
27 | The | |
28 | .I backlog | |
29 | parameter defines the maximum length the queue of | |
30 | pending connections may grow to. | |
31 | If a connection | |
32 | request arrives with the queue full the client will | |
33 | receive an error with an indication of ECONNREFUSED. | |
34 | .SH "RETURN VALUE | |
35 | A 0 return value indicates success; \-1 indicates an error. | |
36 | .SH "ERRORS | |
37 | The call fails if: | |
38 | .TP 20 | |
39 | [EBADF] | |
40 | The argument \fIs\fP is not a valid descriptor. | |
41 | .TP 20 | |
42 | [ENOTSOCK] | |
43 | The argument \fIs\fP is not a socket. | |
44 | .TP 20 | |
45 | [EOPNOTSUPP] | |
46 | The socket is not of a type that supports the operation \fIlisten\fP. | |
47 | .SH "SEE ALSO" | |
48 | accept(2), connect(2), socket(2) | |
49 | .SH BUGS | |
50 | The | |
51 | .I backlog | |
52 | is currently limited (silently) to 5. |