/usr/adm/shutdownlog disappears into the past
[unix-history] / usr / src / lib / libc / sys / listen.2
CommitLineData
cf65baf0
KM
1.\" Copyright (c) 1983 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
ca13daa8 5.\" @(#)listen.2 6.1 (Berkeley) %G%
cf65baf0 6.\"
ca13daa8 7.TH LISTEN 2 ""
cf65baf0
KM
8.UC 5
9.SH NAME
10listen \- listen for connections on a socket
11.SH SYNOPSIS
12.nf
13.ft B
14listen(s, backlog)
15int s, backlog;
16.fi
17.SH DESCRIPTION
18To accept connections, a socket
19is first created with
20.IR socket (2),
21a backlog for incoming connections is specified with
22.IR listen (2)
23and then the connections are
24accepted with
25.IR accept (2).
26The
27.I listen
28call applies only to sockets of type
29SOCK_STREAM
30or
31SOCK_PKTSTREAM.
32.PP
33The
34.I backlog
35parameter defines the maximum length the queue of
36pending connections may grow to.
37If a connection
38request arrives with the queue full the client will
39receive an error with an indication of ECONNREFUSED.
40.SH "RETURN VALUE
41A 0 return value indicates success; \-1 indicates an error.
42.SH "ERRORS
43The call fails if:
44.TP 20
45[EBADF]
46The argument \fIs\fP is not a valid descriptor.
47.TP 20
48[ENOTSOCK]
49The argument \fIs\fP is not a socket.
50.TP 20
51[EOPNOTSUPP]
52The socket is not of a type that supports the operation \fIlisten\fP.
53.SH "SEE ALSO"
54accept(2), connect(2), socket(2)
55.SH BUGS
56The
57.I backlog
58is currently limited (silently) to 5.