date and time created 90/06/23 17:20:37 by trent
[unix-history] / usr / src / lib / libc / sys / listen.2
CommitLineData
da268306
KB
1.\" Copyright (c) 1983 The Regents of the University of California.
2.\" All rights reserved.
cf65baf0 3.\"
da268306
KB
4.\" Redistribution and use in source and binary forms are permitted
5.\" provided that the above copyright notice and this paragraph are
6.\" duplicated in all such forms and that any documentation,
7.\" advertising materials, and other materials related to such
8.\" distribution and use acknowledge that the software was developed
9.\" by the University of California, Berkeley. The name of the
10.\" University may not be used to endorse or promote products derived
11.\" from this software without specific prior written permission.
12.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15.\"
16.\" @(#)listen.2 6.3 (Berkeley) %G%
cf65baf0 17.\"
ca13daa8 18.TH LISTEN 2 ""
cf65baf0
KM
19.UC 5
20.SH NAME
21listen \- listen for connections on a socket
22.SH SYNOPSIS
23.nf
24.ft B
25listen(s, backlog)
26int s, backlog;
27.fi
28.SH DESCRIPTION
29To accept connections, a socket
30is first created with
31.IR socket (2),
3fa31615
MK
32a willingness to accept incoming connections and
33a queue limit for incoming connections are specified with
34.IR listen (2),
cf65baf0
KM
35and then the connections are
36accepted with
37.IR accept (2).
38The
39.I listen
40call applies only to sockets of type
41SOCK_STREAM
42or
3fa31615 43SOCK_SEQPACKET.
cf65baf0
KM
44.PP
45The
46.I backlog
47parameter defines the maximum length the queue of
48pending connections may grow to.
49If a connection
3fa31615
MK
50request arrives with the queue full the client may
51receive an error with an indication of ECONNREFUSED,
52or, if the underlying protocol supports retransmission,
53the request may be ignored so that retries may succeed.
cf65baf0
KM
54.SH "RETURN VALUE
55A 0 return value indicates success; \-1 indicates an error.
56.SH "ERRORS
57The call fails if:
58.TP 20
59[EBADF]
60The argument \fIs\fP is not a valid descriptor.
61.TP 20
62[ENOTSOCK]
63The argument \fIs\fP is not a socket.
64.TP 20
65[EOPNOTSUPP]
66The socket is not of a type that supports the operation \fIlisten\fP.
67.SH "SEE ALSO"
68accept(2), connect(2), socket(2)
69.SH BUGS
70The
71.I backlog
72is currently limited (silently) to 5.