summaryrefslogtreecommitdiffstats
path: root/man-pages-posix-2003/man3p/listen.3p
diff options
context:
space:
mode:
Diffstat (limited to 'man-pages-posix-2003/man3p/listen.3p')
-rw-r--r--man-pages-posix-2003/man3p/listen.3p120
1 files changed, 120 insertions, 0 deletions
diff --git a/man-pages-posix-2003/man3p/listen.3p b/man-pages-posix-2003/man3p/listen.3p
new file mode 100644
index 0000000..840c74c
--- /dev/null
+++ b/man-pages-posix-2003/man3p/listen.3p
@@ -0,0 +1,120 @@
+.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved
+.TH "LISTEN" 3P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
+.\" listen
+.SH PROLOG
+This manual page is part of the POSIX Programmer's Manual.
+The Linux implementation of this interface may differ (consult
+the corresponding Linux manual page for details of Linux behavior),
+or the interface may not be implemented on Linux.
+.SH NAME
+listen \- listen for socket connections and limit the queue of incoming
+connections
+.SH SYNOPSIS
+.LP
+\fB#include <sys/socket.h>
+.br
+.sp
+int listen(int\fP \fIsocket\fP\fB, int\fP \fIbacklog\fP\fB);
+.br
+\fP
+.SH DESCRIPTION
+.LP
+The \fIlisten\fP() function shall mark a connection-mode socket, specified
+by the \fIsocket\fP argument, as accepting
+connections.
+.LP
+The \fIbacklog\fP argument provides a hint to the implementation which
+the implementation shall use to limit the number of
+outstanding connections in the socket's listen queue. Implementations
+may impose a limit on \fIbacklog\fP and silently reduce the
+specified value. Normally, a larger \fIbacklog\fP argument value shall
+result in a larger or equal length of the listen queue.
+Implementations shall support values of \fIbacklog\fP up to SOMAXCONN,
+defined in \fI<sys/socket.h>\fP.
+.LP
+The implementation may include incomplete connections in its listen
+queue. The limits on the number of incomplete connections
+and completed connections queued may be different.
+.LP
+The implementation may have an upper limit on the length of the listen
+queue-either global or per accepting socket. If
+\fIbacklog\fP exceeds this limit, the length of the listen queue is
+set to the limit.
+.LP
+If \fIlisten\fP() is called with a \fIbacklog\fP argument value that
+is less than 0, the function behaves as if it had been
+called with a \fIbacklog\fP argument value of 0.
+.LP
+A \fIbacklog\fP argument of 0 may allow the socket to accept connections,
+in which case the length of the listen queue may be
+set to an implementation-defined minimum value.
+.LP
+The socket in use may require the process to have appropriate privileges
+to use the \fIlisten\fP() function.
+.SH RETURN VALUE
+.LP
+Upon successful completions, \fIlisten\fP() shall return 0; otherwise,
+-1 shall be returned and \fIerrno\fP set to indicate
+the error.
+.SH ERRORS
+.LP
+The \fIlisten\fP() function shall fail if:
+.TP 7
+.B EBADF
+The \fIsocket\fP argument is not a valid file descriptor.
+.TP 7
+.B EDESTADDRREQ
+.sp
+The socket is not bound to a local address, and the protocol does
+not support listening on an unbound socket.
+.TP 7
+.B EINVAL
+The \fIsocket\fP is already connected.
+.TP 7
+.B ENOTSOCK
+The \fIsocket\fP argument does not refer to a socket.
+.TP 7
+.B EOPNOTSUPP
+The socket protocol does not support \fIlisten\fP().
+.sp
+.LP
+The \fIlisten\fP() function may fail if:
+.TP 7
+.B EACCES
+The calling process does not have the appropriate privileges.
+.TP 7
+.B EINVAL
+The \fIsocket\fP has been shut down.
+.TP 7
+.B ENOBUFS
+Insufficient resources are available in the system to complete the
+call.
+.sp
+.LP
+\fIThe following sections are informative.\fP
+.SH EXAMPLES
+.LP
+None.
+.SH APPLICATION USAGE
+.LP
+None.
+.SH RATIONALE
+.LP
+None.
+.SH FUTURE DIRECTIONS
+.LP
+None.
+.SH SEE ALSO
+.LP
+\fIaccept\fP(), \fIconnect\fP(), \fIsocket\fP(), the Base Definitions
+volume of IEEE\ Std\ 1003.1-2001, \fI<sys/socket.h>\fP
+.SH COPYRIGHT
+Portions of this text are reprinted and reproduced in electronic form
+from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
+-- Portable Operating System Interface (POSIX), The Open Group Base
+Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
+Electrical and Electronics Engineers, Inc and The Open Group. In the
+event of any discrepancy between this version and the original IEEE and
+The Open Group Standard, the original IEEE and The Open Group Standard
+is the referee document. The original Standard can be obtained online at
+http://www.opengroup.org/unix/online.html .