listen(2) System Calls Manual listen(2) JMENO listen - cekej na spojeni na soketu KNIHOVNA Standardni knihovna C (libc, -lc) POUZITI #include int listen(int sockfd, int backlog); POPIS Funkce listen() oznaci soket specifikovany parametrem sockfd jako pasivni, to znamena, ze soket bude pouzit pro prijeti pozadavku prichozich spojeni pomoci funkce accept(2). Parametr sockfd je file deskriptor, ktery popisuje soket, ktery je typu SOCK_STREAM nebo SOCK_SEQPACKET. Parametr backlog specifikuje maximalni delku, do ktere fronta cekajicich pozadavku na spojeni prostrednictvim sockfd muze dorust. Je-li fronta zaplnena, obdrzi klient zpravu ECONNREFUSED nebo pokud to nizsi vrstva podporuje znovuzaslani, pozadavek muze byt ignorovan a pozdejsi pokus o spojeni uspeje. NAVRATOVE HODNOTY On success, zero is returned. On error, -1 is returned, and errno is set to indicate the error. CHYBOVE STAVY EADDRINUSE Jiny soket uz nasloucha na danem portu. EADDRINUSE (Internet domain sockets) The socket referred to by sockfd had not previously been bound to an address and, upon attempting to bind it to an ephemeral port, it was determined that all port numbers in the ephemeral port range are currently in use. See the discussion of /proc/sys/net/ipv4/ip_local_port_range in ip(7). EBADF Argument sockfd neni platnym deskriptorem. ENOTSOCK The file descriptor sockfd does not refer to a socket. EOPNOTSUPP Typ soketu neni podporovan volanim listen. STANDARDY POSIX.1-2008. HISTORIE POSIX.1-2001, 4.4BSD (first appeared in 4.2BSD). POZNAMKY K prijeti spojeni jsou provedeny tyto kroky: (1) Je vytvoren soket pomoci socket(2). (2) Soket je navazan na lokalni adresu pomoci bind(2), takze dalsi sokety na nej mohou byt napojeny pomoci connect(2). (3) Ochota k prijeti prichoziho spojeni a limit pro delku fronty jsou specifikovany pomoci listen(). (4) Spojeni je prijato pomoci accept(2). The behavior of the backlog argument on TCP sockets changed with Linux 2.2. Now it specifies the queue length for completely established sockets waiting to be accepted, instead of the number of incomplete connection requests. The maximum length of the queue for incomplete sockets can be set using /proc/sys/net/ipv4/tcp_max_syn_backlog. When syncookies are enabled there is no logical maximum length and this setting is ignored. See tcp(7) for more information. If the backlog argument is greater than the value in /proc/sys/net/core/somaxconn, then it is silently capped to that value. Since Linux 5.4, the default in this file is 4096; in earlier kernels, the default value is 128. Before Linux 2.4.25, this limit was a hard coded value, SOMAXCONN, with the value 128. PRIKLADY Viz bind(2). DALSI INFORMACE accept(2), bind(2), connect(2), socket(2), socket(7) PREKLAD Preklad teto prirucky do spanelstiny vytvorili Pavel Heimlich Tento preklad je bezplatna dokumentace; Prectete si GNU General Public License Version 3 nebo novejsi ohledne podminek autorskych prav. Neexistuje ZADNA ODPOVEDNOST. Pokud narazite na nejake chyby v prekladu teto prirucky, poslete e-mail na adresu . Linux man-pages 6.06 31. rijna 2023 listen(2)