]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - doc/html/ref/net-common-tcpip-manpages-connect.html
Initial revision
[karo-tx-redboot.git] / doc / html / ref / net-common-tcpip-manpages-connect.html
1 <!-- Copyright (C) 2003 Red Hat, Inc.                                -->
2 <!-- This material may be distributed only subject to the terms      -->
3 <!-- and conditions set forth in the Open Publication License, v1.0  -->
4 <!-- or later (the latest version is presently available at          -->
5 <!-- http://www.opencontent.org/openpub/).                           -->
6 <!-- Distribution of the work or derivative of the work in any       -->
7 <!-- standard (paper) book form is prohibited unless prior           -->
8 <!-- permission is obtained from the copyright holder.               -->
9 <HTML
10 ><HEAD
11 ><TITLE
12 >connect</TITLE
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
14 <META
15 NAME="GENERATOR"
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
17 "><LINK
18 REL="HOME"
19 TITLE="eCos Reference Manual"
20 HREF="ecos-ref.html"><LINK
21 REL="UP"
22 TITLE="TCP/IP Library Reference"
23 HREF="tcpip-library-reference.html"><LINK
24 REL="PREVIOUS"
25 TITLE="bind"
26 HREF="net-common-tcpip-manpages-bind.html"><LINK
27 REL="NEXT"
28 TITLE="getpeername"
29 HREF="net-common-tcpip-manpages-getpeername.html"></HEAD
30 ><BODY
31 CLASS="SECT1"
32 BGCOLOR="#FFFFFF"
33 TEXT="#000000"
34 LINK="#0000FF"
35 VLINK="#840084"
36 ALINK="#0000FF"
37 ><DIV
38 CLASS="NAVHEADER"
39 ><TABLE
40 SUMMARY="Header navigation table"
41 WIDTH="100%"
42 BORDER="0"
43 CELLPADDING="0"
44 CELLSPACING="0"
45 ><TR
46 ><TH
47 COLSPAN="3"
48 ALIGN="center"
49 >eCos Reference Manual</TH
50 ></TR
51 ><TR
52 ><TD
53 WIDTH="10%"
54 ALIGN="left"
55 VALIGN="bottom"
56 ><A
57 HREF="net-common-tcpip-manpages-bind.html"
58 ACCESSKEY="P"
59 >Prev</A
60 ></TD
61 ><TD
62 WIDTH="80%"
63 ALIGN="center"
64 VALIGN="bottom"
65 >Chapter 38. TCP/IP Library Reference</TD
66 ><TD
67 WIDTH="10%"
68 ALIGN="right"
69 VALIGN="bottom"
70 ><A
71 HREF="net-common-tcpip-manpages-getpeername.html"
72 ACCESSKEY="N"
73 >Next</A
74 ></TD
75 ></TR
76 ></TABLE
77 ><HR
78 ALIGN="LEFT"
79 WIDTH="100%"></DIV
80 ><DIV
81 CLASS="SECT1"
82 ><H1
83 CLASS="SECT1"
84 ><A
85 NAME="NET-COMMON-TCPIP-MANPAGES-CONNECT">connect</H1
86 ><TABLE
87 BORDER="5"
88 BGCOLOR="#E0E0F0"
89 WIDTH="70%"
90 ><TR
91 ><TD
92 ><PRE
93 CLASS="SCREEN"
94 >CONNECT(2)                    System Calls Manual                   CONNECT(2)
95
96 NAME
97      connect - initiate a connection on a socket
98
99 SYNOPSIS
100      #include &lt;sys/types.h&#62;
101      #include &lt;sys/socket.h&#62;
102
103      int
104      connect(int s, const struct sockaddr *name, socklen_t namelen);
105
106 DESCRIPTION
107      The parameter s is a socket.  If it is of type SOCK_DGRAM, this call
108      specifies the peer with which the socket is to be associated; this
109      address is that to which datagrams are to be sent, and the only address
110      from which datagrams are to be received.  If the socket is of type
111      SOCK_STREAM, this call attempts to make a connection to another socket.
112      The other socket is specified by name, which is an address in the commu-
113      nications space of the socket.  Each communications space interprets the
114      name parameter in its own way.  Generally, stream sockets may success-
115      fully connect() only once; datagram sockets may use connect() multiple
116      times to change their association.  Datagram sockets may dissolve the
117      association by connecting to an invalid address, such as a null address.
118
119 RETURN VALUES
120      If the connection or binding succeeds, 0 is returned.  Otherwise a -1 is
121      returned, and a more specific error code is stored in errno.
122
123 ERRORS
124      The connect() call fails if:
125
126      [EBADF]            S is not a valid descriptor.
127
128      [ENOTSOCK]         S is a descriptor for a file, not a socket.
129
130      [EADDRNOTAVAIL]    The specified address is not available on this
131                         machine.
132
133      [EAFNOSUPPORT]     Addresses in the specified address family cannot be
134                         used with this socket.
135
136      [EISCONN]          The socket is already connected.
137
138      [ETIMEDOUT]        Connection establishment timed out without establish-
139                         ing a connection.
140
141      [EINVAL]           A TCP connection with a local broadcast, the all-ones
142                         or a multicast address as the peer was attempted.
143
144      [ECONNREFUSED]     The attempt to connect was forcefully rejected.
145
146      [EINTR]            A connect was interrupted before it succeeded by the
147                         delivery of a signal.
148
149      [ENETUNREACH]      The network isn't reachable from this host.
150
151      [EADDRINUSE]       The address is already in use.
152
153      [EFAULT]           The name parameter specifies an area outside the pro-
154                         cess address space.
155
156      [EINPROGRESS]      The socket is non-blocking and the connection cannot
157                         be completed immediately.  It is possible to select(2)
158                         or poll(2) for completion by selecting the socket for
159                         writing, and also use getsockopt(2) with SO_ERROR to
160                         check for error conditions.
161
162      [EALREADY]         The socket is non-blocking and a previous connection
163                         attempt has not yet been completed.
164
165      The following errors are specific to connecting names in the UNIX domain.
166      These errors may not apply in future versions of the UNIX IPC domain.
167
168      [ENOTDIR]          A component of the path prefix is not a directory.
169
170      [ENAMETOOLONG]     A component of a pathname exceeded {NAME_MAX} charac-
171                         ters, or an entire path name exceeded {PATH_MAX} char-
172                         acters.
173
174      [ENOENT]           The named socket does not exist.
175
176      [EACCES]           Search permission is denied for a component of the
177                         path prefix.
178
179      [EACCES]           Write access to the named socket is denied.
180
181      [ELOOP]            Too many symbolic links were encountered in translat-
182                         ing the pathname.
183
184 SEE ALSO
185      accept(2), getsockname(2), getsockopt(2), poll(2), select(2), socket(2)
186
187 HISTORY
188      The connect() function call appeared in 4.2BSD.
189
190 BSD                            February 15, 1999                           BSD
191     </PRE
192 ></TD
193 ></TR
194 ></TABLE
195 ></DIV
196 ><DIV
197 CLASS="NAVFOOTER"
198 ><HR
199 ALIGN="LEFT"
200 WIDTH="100%"><TABLE
201 SUMMARY="Footer navigation table"
202 WIDTH="100%"
203 BORDER="0"
204 CELLPADDING="0"
205 CELLSPACING="0"
206 ><TR
207 ><TD
208 WIDTH="33%"
209 ALIGN="left"
210 VALIGN="top"
211 ><A
212 HREF="net-common-tcpip-manpages-bind.html"
213 ACCESSKEY="P"
214 >Prev</A
215 ></TD
216 ><TD
217 WIDTH="34%"
218 ALIGN="center"
219 VALIGN="top"
220 ><A
221 HREF="ecos-ref.html"
222 ACCESSKEY="H"
223 >Home</A
224 ></TD
225 ><TD
226 WIDTH="33%"
227 ALIGN="right"
228 VALIGN="top"
229 ><A
230 HREF="net-common-tcpip-manpages-getpeername.html"
231 ACCESSKEY="N"
232 >Next</A
233 ></TD
234 ></TR
235 ><TR
236 ><TD
237 WIDTH="33%"
238 ALIGN="left"
239 VALIGN="top"
240 >bind</TD
241 ><TD
242 WIDTH="34%"
243 ALIGN="center"
244 VALIGN="top"
245 ><A
246 HREF="tcpip-library-reference.html"
247 ACCESSKEY="U"
248 >Up</A
249 ></TD
250 ><TD
251 WIDTH="33%"
252 ALIGN="right"
253 VALIGN="top"
254 >getpeername</TD
255 ></TR
256 ></TABLE
257 ></DIV
258 ></BODY
259 ></HTML
260 >