.\" -*- coding: UTF-8 -*- .\" Copyright (c) 1983, 1991 The Regents of the University of California. .\" and Copyright (C) 2007, Michael Kerrisk .\" All rights reserved. .\" .\" %%%LICENSE_START(BSD_4_CLAUSE_UCB) .\" 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. .\" %%%LICENSE_END .\" .\" $Id: listen.2,v 1.6 1999/05/18 14:10:32 freitag Exp $ .\" .\" Modified Fri Jul 23 22:07:54 1993 by Rik Faith .\" Modified 950727 by aeb, following a suggestion by Urs Thuermann .\" .\" Modified Tue Oct 22 08:11:14 EDT 1996 by Eric S. Raymond .\" Modified 1998 by Andi Kleen .\" Modified 11 May 2001 by Sam Varshavchik .\" .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH LISTEN 2 "9 juin 2020" Linux "Manuel du programmeur Linux" .SH NOM listen \- Attendre des connexions sur un socket .SH SYNOPSIS .nf \fB#include \fP /* Consultez NOTES */ \fB#include \fP .PP \fBint listen(int \fP\fIsockfd\fP\fB, int \fP\fIbacklog\fP\fB);\fP .fi .SH DESCRIPTION \fBlisten\fP() marque le socket référencé par \fIsockfd\fP comme un socket passif, c'est\-à\-dire comme un socket qui sera utilisé pour accepter les demandes de connexions entrantes en utilisant \fBaccept\fP(2). .PP Le paramètre \fIsockfd\fP est un descripteur de fichier qui fait référence à un socket de type \fBSOCK_STREAM\fP ou \fBSOCK_SEQPACKET\fP. .PP Le paramètre \fIbacklog\fP définit une longueur maximale pour la file des connexions en attente pour \fIsockfd\fP. Si une nouvelle connexion arrive alors que la file est pleine, le client reçoit une erreur indiquant \fBECONNREFUSED\fP, ou, si le protocole sous\(hyjacent supporte les retransmissions, la requête peut être ignorée afin qu'un nouvel essai réussisse. .SH "VALEUR RENVOYÉE" En cas de succès, zéro est renvoyé. En cas d'erreur, \fB\-1\fP est renvoyé et \fIerrno\fP reçoit une valeur adéquate. .SH ERREURS .TP \fBEADDRINUSE\fP Un autre socket est déjà à l'écoute sur le même port. .TP \fBEADDRINUSE\fP (Sockets Internet) Le socket indiqué par \fIsockfd\fP n'a pas encore été attaché a une adresse, et lors d'une tentative d'attachement à un port éphémère, aucun port n'était disponible dans l'intervalle des ports éphémères. Consultez les explications concernant \fI/proc/sys/net/ipv4/ip_local_port_range\fP dans \fBip\fP(7). .TP \fBEBADF\fP \fIsockfd\fP n'est pas un descripteur de fichier valable. .TP \fBENOTSOCK\fP Le descripteur de fichier \fIsockfd\fP ne fait pas référence à un socket. .TP \fBEOPNOTSUPP\fP Le type de socket ne supporte pas l'appel système \fBlisten\fP(). .SH CONFORMITÉ POSIX.1\-2001, POSIX.1\-2008, 4.4BSD (\fBlisten\fP() est apparu dans 4.2BSD). .SH NOTES Pour accepter des connexions, les étapes suivantes sont effectuées\ : .RS 4 .IP 1. 4 Un socket est créé avec \fBsocket\fP(2). .IP 2. Le socket est limité à une adresse locale avec \fBbind\fP(2), ainsi d'autres sockets peuvent y être \fBconnect\fP(2)és. .IP 3. La volonté d'accepter des connexions entrantes et une limite de file pour les connexions entrantes sont spécifiées avec \fBlisten\fP(). .IP 4. Les connexions sont acceptées avec \fBaccept\fP(2). .RE .PP POSIX.1\-2001 ne requiert pas l'inclusion de \fI\fP, et cet en\(hytête n'est pas nécessaire sous Linux. Cependant, il doit être inclus sous certaines implémentations historiques (BSD), et les applications portables devraient probablement l'utiliser. .PP Le comportement de \fIbacklog\fP a été modifié sur les sockets TCP dans Linux 2.2. Il s'agit à présent de la longueur de la file d'attente pour les sockets \fItotalement\fP établis en attente d'acceptation, plutôt que les requêtes de connexion incomplètes. La longueur maximale de la file d'attente des connexions incomplètes peut être configurée avec \fI/proc/sys/net/ipv4/tcp_max_syn_backlog\fP. Lorsque les syncookies sont activés, il n'y a pas de longueur maximale et la configuration est ignorée. Consultez \fBtcp\fP(7) pour plus de détails. .PP .\" The following is now rather historic information (MTK, Jun 05) .\" Don't rely on this value in portable applications since BSD .\" (and some BSD-derived systems) limit the backlog to 5. Si l'argument \fIbacklog\fP est plus grand que la valeur indiquée dans le fichier \fI/proc/sys/net/core/somaxconn\fP, il est tronqué silencieusement à cette valeur. Depuis Linux 5.4, la valeur par défaut dans ce fichier est 4096\ ; dans les noyaux plus anciens, elle était de 128. Dans les noyaux précédant 2.4.25, cette limite était une valeur fixe, \fBSOMAXCONN\fP, qui valait également 128. .SH EXEMPLES Consultez \fBbind\fP(2). .SH "VOIR AUSSI" \fBaccept\fP(2), \fBbind\fP(2), \fBconnect\fP(2), \fBsocket\fP(2), \fBsocket\fP(7) .SH COLOPHON Cette page fait partie de la publication\ 5.10 du projet \fIman\-pages\fP Linux. Une description du projet et des instructions pour signaler des anomalies et la dernière version de cette page peuvent être trouvées à l'adresse \%https://www.kernel.org/doc/man\-pages/. .PP .SH TRADUCTION La traduction française de cette page de manuel a été créée par Christophe Blaess , Stéphan Rafin , Thierry Vignaud , François Micaux, Alain Portal , Jean-Philippe Guérard , Jean-Luc Coulon (f5ibh) , Julien Cristau , Thomas Huriaux , Nicolas François , Florentin Duneau , Simon Paillard , Denis Barbier , David Prévot , Cédric Boutillier , Frédéric Hantrais et Jean-Philippe MENGUAL . .PP Cette traduction est une documentation libre ; veuillez vous reporter à la .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License version 3 .UE concernant les conditions de copie et de distribution. Il n'y a aucune RESPONSABILITÉ LÉGALE. .PP Si vous découvrez un bogue dans la traduction de cette page de manuel, veuillez envoyer un message à .MT debian-l10n-french@lists.debian.org .ME .