.\" Copyright (c) 1983, 1991 The Regents of the University of California. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)listen.2 6.5 (Berkeley) 3/10/91 .\" .\" Modified Fri Jul 23 22:07:54 1993 by Rik Faith (faith@cs.unc.edu) .\" Modified 950727 by aeb, following a suggestion by Urs Thuermann .\" (urs@isnogud.escape.de) .\" Translated into german by Martin Schulze (joey@finlandia.infodrom.north.de) .\" .TH LISTEN 2 "17. August 1996" "BSD Man Page" "Systemaufrufe" .SH BEZEICHNUNG listen \- Horche auf einem Socket auf Verbindungen .SH "ÜBERSICHT" .B #include .sp .BI "int listen(int " s ", int " backlog ); .SH BESCHREIBUNG Um eine Verbindung anzunehmen, muss ein Socket zuerst mit .BR socket (2) erzeugt werden. Der Wunsch, eingehende Verbindungen anzunehmen sowie ein Limit an nicht bearbeiteten Verbindungen, die in einer Warteschleife gehalten werden, wird mit .B listen() angezeigt. Anschließend werden Verbindungen mit .BR accept (2) angenommen. Der Aufruf von .B listen ist für Sockets vom Typ .B SOCK_STREAM und .B SOCK_SEQPACKET gültig. Das Argument .I backlog spezifiziert die maximale Länge der Warteschlange, die noch nicht angenommene Verbindungen aufnimmt. Wenn eine Verbindungsanfrage ankommt und die Warteschlange ist bereits voll, dann erhält der Client einen Fehler mit der Angabe .B ECONNREFUSED oder die Anfrage wird ignoriert, wenn das zugrundeliegende Protokoll "Retransmission" unterstützt, damit weitere Versuche erfolgreich sind. .SH "RÜCKGABEWERT" Bei Erfolg wird null zurückgegeben, bei einem Fehler \-1 und .I errno wird entsprechend gesetzt. .SH FEHLER .TP .B EBADF Das Argument .I s ist kein gültiger Deskriptor. .TP .B ENOTSOCK Das Argument .I s ist kein Socket. .TP .B EOPNOTSUPP Der Socket ist nicht von einem Typ, der die Operation .B listen unterstützt. .SH GESCHICHTE Die Funktion .B listen tauchte in BSD 4.2 auf. .SH BUGS Wenn der Socket vom Typ af_inet ist und das Argument .I backlog größer als 128 ist, wird es stillschweigend auf 128 gekürzt. Um portable Anwendungen zu schreiben, sollte nicht auf solche Werte vertraut werden, denn BSD (und wenigstens einige BSD-basierte Systeme) limitieren .I backlog auf 5 Verbindungen. .SH "SIEHE AUCH" .BR accept (2), .BR connect (2), .BR socket (2).