.\" -*- coding: UTF-8 -*- .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu) .\" Portions extracted from /usr/include/sys/socket.h, which does not have .\" any authorship information in it. It is probably available under the GPL. .\" .\" SPDX-License-Identifier: Linux-man-pages-copyleft .\" .\" .\" Other portions are from the 6.9 (Berkeley) 3/10/91 man page: .\" .\" Copyright (c) 1983 The Regents of the University of California. .\" All rights reserved. .\" .\" SPDX-License-Identifier: BSD-4-Clause-UC .\" .\" Modified 1997-01-31 by Eric S. Raymond .\" Modified 1998, 1999 by Andi Kleen .\" Modified 2004-06-23 by Michael Kerrisk .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH connect 2 "30. března 2023" "Linux man\-pages 6.05.01" .SH JMÉNO connect \- inicializuj spojení soketu .SH KNIHOVNA Standardní knihovna C (\fIlibc\fP, \fI\-lc\fP) .SH POUŽITÍ .nf \fB#include \fP .PP \fBint connect(int \fP\fIsockfd\fP\fB, const struct sockaddr *\fP\fIaddr\fP\fB,\fP \fB socklen_t \fP\fIaddrlen\fP\fB);\fP .fi .SH POPIS Systémové volání \fBconnect\fP() připojí soket specifikovaný v \fIsockfd\fP k adrese specifikované v \fIaddr\fP. Parametr \fIaddrlen\fP udává velikost \fIaddr\fP. Formát adresy v \fIaddr\fP je dán adresovým prostorem deskriptoru v \fIsockfd\fP. Viz \fBsocket\fP(2) pro více detailů. .PP Parametr \fIsockfd\fP je soket. Je\-li jeho typ \fBSOCK_DGRAM\fP, pak je \fIaddr\fP jediným místem, odkud a kam budou přijímány, resp. posílány datagramy. Je\-li typ soketu \fBSOCK_STREAM\fP, nebo \fBSOCK_SEQPACKET\fP potom se toto volání pokusí navázat spojení se soketem, který je specifikován v \fIaddr\fP, což je adresa v jmenném prostoru soketu. Každý jmenný prostor interpretuje adresu v \fBaddr\fP. .PP Some protocol sockets (e.g., UNIX domain stream sockets) may successfully \fBconnect\fP() only once. .PP Some protocol sockets (e.g., datagram sockets in the UNIX and Internet domains) may use \fBconnect\fP() multiple times to change their association. .PP Some protocol sockets (e.g., TCP sockets as well as datagram sockets in the UNIX and Internet domains) may dissolve the association by connecting to an address with the \fIsa_family\fP member of \fIsockaddr\fP set to \fBAF_UNSPEC\fP; thereafter, the socket can be connected to another address. (\fBAF_UNSPEC\fP is supported since Linux 2.2.) .SH "NÁVRATOVÉ HODNOTY" If the connection or binding succeeds, zero is returned. On error, \-1 is returned, and \fIerrno\fP is set to indicate the error. .SH "CHYBOVÉ STAVY" Tento seznam je pouze všeobecný. Mohou existovat další specifické chyby pro použitý jmenný prostor. .TP \fBEACCES\fP Pro sokety UNIXové domény, které jsou identifikovány jménem: je odmítnuto zapisování do souboru specifikovaného soketem, nebo je odmítnuto právo vyhledávat v adresářích specifikovaných cestou. (Viz \fBpath_resolution\fP(7).) .TP \fBEACCES\fP, \fBEPERM\fP Uživatel se pokusil připojit k broadcastové adrese, aniž by měl povolen broadcastový příznak na soketu, nebo požadavek na spojení byl odmítnut kvůli lokálnímu pravidlu firewallu. .TP \fBEACCES\fP It can also be returned if an SELinux policy denied a connection (for example, if there is a policy saying that an HTTP proxy can only connect to ports associated with HTTP servers, and the proxy tries to connect to a different port). .TP \fBEADDRINUSE\fP Adresa je již používána. .TP \fBEADDRNOTAVAIL\fP (Internet domain sockets) The socket referred to by \fIsockfd\fP 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 \fI/proc/sys/net/ipv4/ip_local_port_range\fP in \fBip\fP(7). .TP \fBEAFNOSUPPORT\fP Poskytnutá adresa nemá správně specifikovanou rodinu adres v poli \fIsa_family\fP. .TP \fBEAGAIN\fP For nonblocking UNIX domain sockets, the socket is nonblocking, and the connection cannot be completed immediately. For other socket families, there are insufficient entries in the routing cache. .TP \fBEALREADY\fP Soket je neblokující a předchozí pokus o spojení ještě nebyl dokončen. .TP \fBEBADF\fP \fIsockfd\fP is not a valid open file descriptor. .TP \fBECONNREFUSED\fP A \fBconnect\fP() on a stream socket found no one listening on the remote address. .TP \fBEFAULT\fP Adresa soketu je mimo adresový prostor procesu. .TP \fBEINPROGRESS\fP The socket is nonblocking and the connection cannot be completed immediately. (UNIX domain sockets failed with \fBEAGAIN\fP instead.) It is possible to \fBselect\fP(2) or \fBpoll\fP(2) for completion by selecting the socket for writing. After \fBselect\fP(2) indicates writability, use \fBgetsockopt\fP(2) to read the \fBSO_ERROR\fP option at level \fBSOL_SOCKET\fP to determine whether \fBconnect\fP() completed successfully (\fBSO_ERROR\fP is zero) or unsuccessfully (\fBSO_ERROR\fP is one of the usual error codes listed here, explaining the reason for the failure). .TP \fBEINTR\fP .\" For TCP, the connection will complete asynchronously. .\" See http://lkml.org/lkml/2005/7/12/254 Systémové volání bylo přerušeno doručením signálu. Viz \fBsignal\fP(7). .TP \fBEISCONN\fP Soket je již spojen. .TP \fBENETUNREACH\fP Síť není dosažitelná. .TP \fBENOTSOCK\fP The file descriptor \fIsockfd\fP does not refer to a socket. .TP \fBEPROTOTYPE\fP The socket type does not support the requested communications protocol. This error can occur, for example, on an attempt to connect a UNIX domain datagram socket to a stream socket. .TP \fBETIMEDOUT\fP Timeout při pokusu o navázání spojení. Server může být příliš zaneprázdněn a není schopen přijmou další spojení. Vězte, že pro IP sokety může být timeout velmi dlouhý, pokud jsou syncookies povoleny na straně serveru. .SH STANDARDY POSIX.1\-2008. .SH HISTORIE .\" SVr4 documents the additional .\" general error codes .\" .BR EADDRNOTAVAIL , .\" .BR EINVAL , .\" .BR EAFNOSUPPORT , .\" .BR EALREADY , .\" .BR EINTR , .\" .BR EPROTOTYPE , .\" and .\" .BR ENOSR . .\" It also .\" documents many additional error conditions not described here. POSIX.1\-2001, SVr4, 4.4BSD, (\fBconnect\fP() se poprvé objevila ve 4.2BSD). .SH POZNÁMKY If \fBconnect\fP() fails, consider the state of the socket as unspecified. Portable applications should close the socket and create a new one for reconnecting. .SH PŘÍKLADY Příklad použití \fBconnect\fP() je v \fBgetaddrinfo\fP(3). .SH "DALŠÍ INFORMACE" \fBaccept\fP(2), \fBbind\fP(2), \fBgetsockname\fP(2), \fBlisten\fP(2), \fBsocket\fP(2), \fBpath_resolution\fP(7), \fBselinux\fP(8) .PP .SH PŘEKLAD Překlad této příručky do španělštiny vytvořili Pavel Heimlich . .PP Tento překlad je bezplatná dokumentace; Přečtěte si .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3 .UE nebo novější ohledně podmínek autorských práv. Neexistuje ŽÁDNÁ ODPOVĚDNOST. .PP Pokud narazíte na nějaké chyby v překladu této příručky, pošlete e-mail na adresu .MT translation-team-cs@lists.sourceforge.net .ME .