44 lines
2.1 KiB
HTML
44 lines
2.1 KiB
HTML
<html><!-- This HTML file has been created by texi2html 1.29
|
|
from syscalls.texi on 4 June 1994 -->
|
|
|
|
<TITLE>Syscall specifications of Linux - connect</TITLE>
|
|
<P>Go to the <A HREF="syscalls_42.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_42.html">previous</A>, <A HREF="syscalls_44.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_44.html">next</A> section.<P>
|
|
<H2><A NAME="SEC43" HREF="syscalls_toc.html#SEC43" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_toc.html#SEC43">connect</A></H2>
|
|
<P>
|
|
<H3>SYNOPSIS</H3>
|
|
<P>
|
|
<CODE>int connect(int <VAR>sockfd</VAR>, struct sockaddr *<VAR>serv_addr</VAR>, int
|
|
<VAR>addrlen</VAR>);</CODE>
|
|
<P>
|
|
<H3>PARAMETERS</H3>
|
|
<P>
|
|
<VAR>sockfd</VAR>: [in] the socket to connect.
|
|
<P>
|
|
<VAR>serv_addr</VAR>: [in] the remote address to connect to.
|
|
<P>
|
|
<VAR>addrlen</VAR>: [in] the lenght (in bytes) of <VAR>serv_addr</VAR>.
|
|
<P>
|
|
<H3>DESCRIPTION</H3>
|
|
<P>
|
|
If the socket is of type <CODE>SOCK_DGRAM</CODE>, it connects the socket
|
|
<VAR>sockfd</VAR> to a remote address specified by <VAR>serv_addr</VAR>. A
|
|
datagram socket can call <CODE>connect</CODE> multiple times to change the
|
|
remote address. If the socket is of type <CODE>SOCK_STREAM</CODE>, it connects
|
|
the socket to another socket. In that case, the format of
|
|
<VAR>serv_addr</VAR> depends on the communication space of the socket. A
|
|
stream socket may only call <CODE>connect</CODE> once.
|
|
<P>
|
|
<H3>RETURN VALUE</H3>
|
|
<P>
|
|
On success zero is returned. On error, -1 is returned and <CODE>errno</CODE> is
|
|
set to one of the following values:
|
|
<P>
|
|
<UL>
|
|
<LI><CODE>EINVAL</CODE>: the socket is in some kind of limbo state: neither
|
|
connected nor unconnected!!!
|
|
<LI><CODE>EBADF</CODE>, <CODE>ENOTSOCK</CODE>, <CODE>EISCONN</CODE>, <CODE>EALREADY</CODE>,
|
|
<CODE>EAGAIN</CODE>, <CODE>EOPNOTSUPP</CODE>, <CODE>EINPROGRESS</CODE>, <CODE>ERESTARTSYS</CODE>.
|
|
</UL>
|
|
<P>
|
|
<P>Go to the <A HREF="syscalls_42.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_42.html">previous</A>, <A HREF="syscalls_44.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_44.html">next</A> section.<P>
|