OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / draft / man2 / connect.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
4 .\" Portions extracted from /usr/include/sys/socket.h, which does not have
5 .\" any authorship information in it.  It is probably available under the GPL.
6 .\"
7 .\" Permission is granted to make and distribute verbatim copies of this
8 .\" manual provided the copyright notice and this permission notice are
9 .\" preserved on all copies.
10 .\"
11 .\" Permission is granted to copy and distribute modified versions of this
12 .\" manual under the conditions for verbatim copying, provided that the
13 .\" entire resulting derived work is distributed under the terms of a
14 .\" permission notice identical to this one.
15 .\"
16 .\" Since the Linux kernel and libraries are constantly changing, this
17 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
18 .\" responsibility for errors or omissions, or for damages resulting from
19 .\" the use of the information contained herein.  The author(s) may not
20 .\" have taken the same level of care in the production of this manual,
21 .\" which is licensed free of charge, as they might when working
22 .\" professionally.
23 .\"
24 .\" Formatted or processed versions of this manual, if unaccompanied by
25 .\" the source, must acknowledge the copyright and authors of this work.
26 .\"
27 .\"
28 .\" Other portions are from the 6.9 (Berkeley) 3/10/91 man page:
29 .\"
30 .\" Copyright (c) 1983 The Regents of the University of California.
31 .\" All rights reserved.
32 .\"
33 .\" Redistribution and use in source and binary forms, with or without
34 .\" modification, are permitted provided that the following conditions
35 .\" are met:
36 .\" 1. Redistributions of source code must retain the above copyright
37 .\"    notice, this list of conditions and the following disclaimer.
38 .\" 2. Redistributions in binary form must reproduce the above copyright
39 .\"    notice, this list of conditions and the following disclaimer in the
40 .\"    documentation and/or other materials provided with the distribution.
41 .\" 3. All advertising materials mentioning features or use of this software
42 .\"    must display the following acknowledgement:
43 .\"     This product includes software developed by the University of
44 .\"     California, Berkeley and its contributors.
45 .\" 4. Neither the name of the University nor the names of its contributors
46 .\"    may be used to endorse or promote products derived from this software
47 .\"    without specific prior written permission.
48 .\"
49 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
50 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
51 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
52 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 .\" SUCH DAMAGE.
60 .\"
61 .\" Modified 1997-01-31 by Eric S. Raymond <esr@thyrsus.com>
62 .\" Modified 1998, 1999 by Andi Kleen
63 .\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
64 .\"
65 .\" Japanese Version Copyright (c) 1996 Yosiaki Yanagihara
66 .\"         all rights reserved.
67 .\" Translated 1996-06-25, Yosiaki Yanagihara <yosiaki@bsd2.kbnes.nec.co.jp>
68 .\" Updated & Modified 1997-11-06, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
69 .\" Updated & Modified 1999-08-14, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
70 .\" Updated & Modified 2000-01-13, Kentaro Shirakata <argrath@yo.rim.or.jp>
71 .\" Updated & Modified 2005-02-23, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
72 .\" Updated & Modified 2005-10-05, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
73 .\"
74 .TH CONNECT 2 2008-12-03 "Linux" "Linux Programmer's Manual"
75 .\"O .SH NAME
76 .SH Ì¾Á°
77 .\"O connect \- initiate a connection on a socket
78 connect \- ¥½¥±¥Ã¥È¤ÎÀܳ¤ò¹Ô¤¦
79 .\"O .SH SYNOPSIS
80 .SH ½ñ¼°
81 .nf
82 .\"O .BR "#include <sys/types.h>" "          /* See NOTES */"
83 .BR "#include <sys/types.h>" "          /* ¡ÖÃí°Õ¡×»²¾È */"
84 .br
85 .B #include <sys/socket.h>
86 .sp
87 .BI "int connect(int " sockfd ", const struct sockaddr *" addr ,
88 .BI "            socklen_t " addrlen );
89 .fi
90 .\"O .SH DESCRIPTION
91 .SH ÀâÌÀ
92 .\"O The
93 .\"O .BR connect ()
94 .\"O system call connects the socket referred to by the file descriptor
95 .\"O .I sockfd
96 .\"O to the address specified by
97 .\"O .IR addr .
98 .\"O The
99 .\"O .I addrlen
100 .\"O argument specifies the size of
101 .\"O .IR addr .
102 .\"O The format of the address in
103 .\"O .I addr
104 .\"O is determined by the address space of the socket
105 .\"O .IR sockfd ;
106 .\"O see
107 .\"O .BR socket (2)
108 .\"O for further details.
109 .BR connect ()
110 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¡¢¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿
111 .I sockfd
112 ¤¬»²¾È¤·¤Æ¤¤¤ë¥½¥±¥Ã¥È¤ò
113 .I addr
114 ¤Ç»ØÄꤵ¤ì¤¿¥¢¥É¥ì¥¹¤ËÀܳ¤¹¤ë¡£
115 .I addrlen
116 °ú¤­¿ô¤Ï
117 .I addr
118 ¤ÎÂ礭¤µ¤ò¼¨¤¹¡£
119 .I addr
120 ¤Î¥¢¥É¥ì¥¹¤Î¥Õ¥©¡¼¥Þ¥Ã¥È¤Ï¥½¥±¥Ã¥È
121 .I sockfd
122 ¤Î¥¢¥É¥ì¥¹¶õ´Ö¤Ë¤è¤ê°Û¤Ê¤ë¡£
123 ¤µ¤é¤Ê¤ë¾ÜºÙ¤Ï
124 .BR socket (2)
125 ¤ò»²¾È¤Î¤³¤È¡£
126
127 .\"O If the socket
128 .\"O .I sockfd
129 .\"O is of type
130 .\"O .B SOCK_DGRAM
131 .\"O then
132 .\"O .I addr
133 .\"O is the address to which datagrams are sent by default, and the only
134 .\"O address from which datagrams are received.
135 .\"O If the socket is of type
136 .\"O .B SOCK_STREAM
137 .\"O or
138 .\"O .BR SOCK_SEQPACKET ,
139 .\"O this call attempts to make a connection to the socket that is bound
140 .\"O to the address specified by
141 .\"O .IR addr .
142 ¥½¥±¥Ã¥È
143 .I sockfd
144 ¤¬
145 .B SOCK_DGRAM
146 ·¿¤Ç¤¢¤ì¤Ð¡¢
147 .I addr
148 ¤Ï¡¢¥Ç¥Õ¥©¥ë¥È¤Î¥Ç¡¼¥¿¥°¥é¥à¤ÎÁ÷¿®Àè¤Î¥¢¥É¥ì¥¹¤Ç¤¢¤ê¡¢
149 ¥Ç¡¼¥¿¥°¥é¥à¤ò¼õ¿®¤¹¤ëÍ£°ì¤Î¥¢¥É¥ì¥¹¤ò¼¨¤¹¤Ë²á¤®¤Ê¤¤¡£
150 ¥½¥±¥Ã¥È¤¬
151 .B SOCK_STREAM
152 ·¿¤â¤·¤¯¤Ï
153 .B SOCK_SEQPACKET
154 ·¿¤Ç¤¢¤ì¤Ð¡¢¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï
155 .I addr
156 ¤Ç»ØÄꤵ¤ì¤¿¥¢¥É¥ì¥¹¤Ë·ë¤ÓÉÕ¤±¤é¤ì¤¿¥½¥±¥Ã¥È¤ËÂФ¹¤ëÀܳ¤Î
157 ºîÀ®¤ò»î¤ß¤ë¡£
158 .PP
159 .\"O Generally, connection-based protocol sockets may successfully
160 .\"O .BR connect ()
161 .\"O only once; connectionless protocol sockets may use
162 .\"O .BR connect ()
163 .\"O multiple times to change their association.
164 .\"O Connectionless sockets may
165 .\"O dissolve the association by connecting to an address with the
166 .\"O .I sa_family
167 .\"O member of
168 .\"O .I sockaddr
169 .\"O set to
170 .\"O .BR AF_UNSPEC
171 .\"O (supported on Linux since kernel 2.2).
172 °ìÈÌŪ¤Ë¡¢Àܳ»Ø¸þ (connection-oriented) ¥×¥í¥È¥³¥ë¤Ç¤Ï°ìÅÙ¤À¤±
173 .BR connect ()
174 ¤¬À®¸ù¤¹¤ë¡£
175 ÈóÀܳ (connectionless) ¥×¥í¥È¥³¥ë¤Ç¤ÏÂбþ¤òÊѹ¹¤¹¤ë¤¿¤á¤Ë²¿ÅÙ¤â
176 .BR connect ()
177 ¤ò»ÈÍѤǤ­¤ë¡£
178 ÈóÀܳ¥½¥±¥Ã¥È¤Ï
179 .I sockaddr
180 ¤Î
181 .I sa_family
182 ¥á¥ó¥Ð¤Ë
183 .B AF_UNSPEC
184 ¤òÀßÄꤹ¤ë¤³¤È¤Ç¡¢Àܳ¥¢¥É¥ì¥¹¤ÎÂбþ¤ò²ò¾Ã¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë
185 .RB ( AF_UNSPEC
186 ¤Ï¥«¡¼¥Í¥ë 2.2 °Ê¹ß¤Î Linux ¤Ç¥µ¥Ý¡¼¥È)¡£
187 .\"O .SH "RETURN VALUE"
188 .SH ÊÖ¤êÃÍ
189 .\"O If the connection or binding succeeds, zero is returned.
190 .\"O On error, \-1 is
191 .\"O returned, and
192 .\"O .I errno
193 .\"O is set appropriately.
194 Àܳ¤Þ¤¿¤ÏÂбþ¤Å¤±¤ËÀ®¸ù¤¹¤ë¤È¥¼¥í¤òÊÖ¤¹¡£
195 ¼ºÇÔ¤¹¤ë¤È \-1 ¤òÊÖ¤·¡¢
196 .I errno
197 ¤ËŬÀÚ¤ÊÃͤòÀßÄꤹ¤ë¡£
198 .\"O .SH ERRORS
199 .SH ¥¨¥é¡¼
200 .\"O The following are general socket errors only.
201 .\"O There may be other domain-specific error codes.
202 °Ê²¼¤Ï°ìÈÌŪ¤Ê¥½¥±¥Ã¥È¤Ë¤Ä¤¤¤Æ¤Î¥¨¥é¡¼¤Ç¤¢¤ë¡£Â¾¤Ë¥É¥á¥¤¥óÆÃÍ­¤Î¥¨¥é¡¼
203 ¤¬È¯À¸¤¹¤ë²ÄǽÀ­¤¬¤¢¤ë¡£
204 .TP
205 .B EACCES
206 .\"O For Unix domain sockets, which are identified by pathname:
207 .\"O Write permission is denied on the socket file,
208 .\"O or search permission is denied for one of the directories
209 .\"O in the path prefix.
210 .\"O (See also
211 .\"O .BR path_resolution (7).)
212 Unix ¥É¥á¥¤¥ó¥½¥±¥Ã¥È¤Ï¥Ñ¥¹Ì¾¤Ç¼±Ê̤µ¤ì¤ë¡£
213 ¥½¥±¥Ã¥È¡¦¥Õ¥¡¥¤¥ë¤Ø¤Î½ñ¤­¹þ¤ßµö²Ä¤¬¤Ê¤«¤Ã¤¿¤«¡¢¥Ñ¥¹Ì¾¤Ø
214 Åþ㤹¤ë¤Þ¤Ç¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Î¤¤¤º¤ì¤«¤ËÂФ¹¤ë¸¡º÷µö²Ä¤¬¤Ê¤«¤Ã¤¿¡£
215 .RB ( path_resolution (7)
216 ¤â»²¾È¤Î¤³¤È)
217 .TP
218 .BR EACCES ", " EPERM
219 .\"O The user tried to connect to a broadcast address without having the socket
220 .\"O broadcast flag enabled or the connection request failed because of a local
221 .\"O firewall rule.
222 ¥½¥±¥Ã¥È¤Î¥Ö¥í¡¼¥É¥­¥ã¥¹¥È¡¦¥Õ¥é¥°¤¬Í­¸ú¤Ë¤Ê¤Ã¤Æ¤¤¤Ê¤¤¤Î¤Ë
223 ¥æ¡¼¥¶¤¬¥Ö¥í¡¼¥É¥­¥ã¥¹¥È¤ØÀܳ¤ò»î¤ß¤¿¡£¤Þ¤¿¤Ï¡¢¥í¡¼¥«¥ë¤Î¥Õ¥¡¥¤¥¢¥¦¥©¡¼¥ë¤Î
224 µ¬Â§¤Ë¤è¤êÀܳ¤ÎÍ׵᤬¼ºÇÔ¤·¤¿¡£
225 .TP
226 .B EADDRINUSE
227 .\"O Local address is already in use.
228 ¥í¡¼¥«¥ë¥¢¥É¥ì¥¹¤¬´û¤Ë»ÈÍѤµ¤ì¤Æ¤¤¤ë¡£
229 .TP
230 .B EAFNOSUPPORT
231 .\"O The passed address didn't have the correct address family in its
232 .\"O .I sa_family
233 .\"O field.
234 ÅϤµ¤ì¤¿¥¢¥É¥ì¥¹¤Î
235 .I sa_family
236 ¥Õ¥£¡¼¥ë¥É¤¬Àµ¤·¤¤¥¢¥É¥ì¥¹¡¦¥Õ¥¡¥ß¥ê¡¼¤Ç¤Ï¤Ê¤¤¡£
237 .TP
238 .B EAGAIN
239 .\"O No more free local ports or insufficient entries in the routing cache.
240 .\"O For
241 .\"O .B AF_INET
242 .\"O see the description of
243 .\"O .I /proc/sys/net/ipv4/ip_local_port_range
244 .\"O .BR ip (7)
245 .\"O for information on how to increase the number of local ports.
246 »ÈÍѲÄǽ¤Ê¥í¡¼¥«¥ë¤Î¥Ý¡¼¥È¤¬¤Ê¤¤¤«¡¢
247 ¥ë¡¼¥Æ¥£¥ó¥°¥­¥ã¥Ã¥·¥å¤Ë½½Ê¬¤Ê¥¨¥ó¥È¥ê¤¬¤Ê¤¤¡£
248 .B AF_INET
249 ¤Î¾ì¹ç¤Ë¡¢¥í¡¼¥«¥ë¥Ý¡¼¥È¤Î¿ô¤òÁý¤ä¤¹ÊýË¡¤Ë¤Ä¤¤¤Æ¤Ï¡¢
250 .BR ip (7)
251 ¤Î
252 .I /proc/sys/net/ipv4/ip_local_port_range
253 ¤ÎÀâÌÀ¤ò»²¾È¤Î¤³¤È¡£
254 .TP
255 .B EALREADY
256 .\"O The socket is nonblocking and a previous connection attempt has not yet
257 .\"O been completed.
258 ¥½¥±¥Ã¥È¤¬ÈóÄä»ß (nonblocking) ¤ËÀßÄꤵ¤ì¤Æ¤ª¤ê¡¢
259 Á°¤ÎÀܳ¤¬´°Î»¤·¤Æ¤¤¤Ê¤¤¡£
260 .TP
261 .B EBADF
262 .\"O The file descriptor is not a valid index in the descriptor table.
263 ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼¤¬¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼¥Æ¡¼¥Ö¥ë¤Î
264 Í­¸ú¤Ê¥¤¥ó¥Ç¥Ã¥¯¥¹¤Ç¤Ï¤Ê¤¤¡£
265 .TP
266 .B ECONNREFUSED
267 .\"O No-one listening on the remote address.
268 ¥ê¥â¡¼¥È¥¢¥É¥ì¥¹¤ÇÀܳ¤òÂԤäƤ¤¤ë¥×¥í¥°¥é¥à¤¬¤Ê¤¤¡£
269 .TP
270 .B EFAULT
271 .\"O The socket structure address is outside the user's address space.
272 ¥½¥±¥Ã¥È¹½Â¤ÂΤΥ¢¥É¥ì¥¹¤¬¥æ¡¼¥¶¡¼¤Î¥¢¥É¥ì¥¹¶õ´Ö³°¤Ë¤¢¤ë¡£
273 .TP
274 .B EINPROGRESS
275 .\"O The socket is nonblocking and the connection cannot be completed
276 .\"O immediately.  It is possible to
277 .\"O .BR select (2)
278 .\"O or
279 .\"O .BR poll (2)
280 .\"O for completion by selecting the socket for writing.
281 .\"O After
282 .\"O .BR select (2)
283 .\"O indicates writability, use
284 .\"O .BR getsockopt (2)
285 .\"O to read the
286 .\"O .B SO_ERROR
287 .\"O option at level
288 .\"O .B SOL_SOCKET
289 .\"O to determine whether
290 .\"O .BR connect ()
291 .\"O completed successfully
292 .\"O .RB ( SO_ERROR
293 .\"O is zero) or unsuccessfully
294 .\"O .RB ( SO_ERROR
295 .\"O is one of the usual error codes listed here,
296 .\"O explaining the reason for the failure).
297 ¥½¥±¥Ã¥È¤¬ÈóÄä»ß (nonblocking) ¤ËÀßÄꤵ¤ì¤Æ¤¤¤Æ¡¢Àܳ¤ò¤¹¤°¤Ë
298 ´°Î»¤¹¤ë¤³¤È¤¬¤Ç¤­¤Ê¤¤¡£¤½¤Î¾ì¹ç¡¢
299 .BR select (2)
300 ¤ä
301 .BR poll (2)
302 ¤ò»È¤Ã¤Æ¤½¤Î¥½¥±¥Ã¥È¤¬½ñ¤­¹þ¤ß²Äǽ¤Ë¤Ê¤ë¤Î¤òÂԤĤ³¤È¤Ç¡¢
303 Àܳ¤Î´°Î»¤òÃΤ뤳¤È¤¬¤Ç¤­¤ë¡£
304 .BR select (2)
305 ¤Ç½ñ¤­¹þ¤ß²Äǽ¤Ë¤Ê¤Ã¤¿¸å¤Ë¡¢
306 .BR getsockopt (2)
307 ¤ò»È¤Ã¤Æ
308 .B SOL_SOCKET
309 ¥ì¥Ù¥ë¤Ç
310 .B SO_ERROR
311 ¥ª¥×¥·¥ç¥ó¤òÆɤ߽Ф¹¤³
312 ¤È¤Ë¤è¤ê¡¢
313 .BR connect ()
314 ¤¬À®¸ù¤·¤¿¤«¡¢¼ºÇÔ¤·¤¿¤«¤òȽÃǤǤ­¤ë¡£
315 À®¸ù¤Î¾ì¹ç
316 .B SO_ERROR
317 ¤¬ 0 ¤Ç¤¢¤ê¡¢
318 ¼ºÇԤξì¹ç
319 .B SO_ERROR
320 ¤¬¤³¤³¤Î¥ê¥¹¥È¤Ë¤¢¤ë¤¤¤º¤ì¤«¤Î¥¨¥é¡¼¥³¡¼¥É¤Ç¤¢¤ê¡¢
321 ¤½¤ì¤Ë¤è¤ê¼ºÇԤθ¶°ø¤¬Ê¬¤«¤ë¡£
322 .TP
323 .B EINTR
324 .\"O The system call was interrupted by a signal that was caught; see
325 .\"O .BR signal (7).
326 .\"O .\" For TCP, the connection will complete asynchronously.
327 .\"O .\" See http://lkml.org/lkml/2005/7/12/254
328 Ê᪤µ¤ì¤¿¥·¥°¥Ê¥ë¤Ë¤è¤ê¥·¥¹¥Æ¥à¥³¡¼¥ë¤¬ÃæÃǤµ¤ì¤¿¡£
329 .BR signal (7)
330 »²¾È¡£
331 .\" TCP ¤Î¾ì¹ç¤Ï¡¢Àܳ½èÍý¤ÏÈóƱ´ü¤Ë¤Ê¤ë¤¬´°Î»¤¹¤ë¤À¤í¤¦¡£
332 .\" http://lkml.org/lkml/2005/7/12/254 ¤ò»²¾È¤Î¤³¤È¡£
333 .TP
334 .B EISCONN
335 .\"O The socket is already connected.
336 ¥½¥±¥Ã¥È¤Ï´û¤ËÀܳ (connect) ¤µ¤ì¤Æ¤¤¤ë¡£
337 .TP
338 .B ENETUNREACH
339 .\"O Network is unreachable.
340 Åþã¤Ç¤­¤Ê¤¤¥Í¥Ã¥È¥ï¡¼¥¯¤Ç¤¢¤ë¡£
341 .TP
342 .B ENOTSOCK
343 .\"O The file descriptor is not associated with a socket.
344 ¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼¤¬¥½¥±¥Ã¥È¤È´ØÏ¢ÉÕ¤±¤é¤ì¤Æ¤¤¤Ê¤¤¡£
345 .TP
346 .B ETIMEDOUT
347 .\"O Timeout while attempting connection.
348 .\"O The server may be too
349 .\"O busy to accept new connections.
350 .\"O Note that for IP sockets the timeout may
351 .\"O be very long when syncookies are enabled on the server.
352 Àܳ¤ò»î¤ß¤Æ¤¤¤ëÅÓÃæ¤Ç»þ´ÖÀÚ¤ì (timeout) ¤Ë¤Ê¤Ã¤¿¡£¥µ¡¼¥Ð¡¼¤¬º®»¨¤·¤Æ¤¤¤Æ
353 ¿·¤¿¤ÊÀܳ¤ò¼õ¤±Æþ¤ì¤é¤ì¤Ê¤¤¤Î¤«¤â¤·¤ì¤Ê¤¤¡£
354 IP ¥½¥±¥Ã¥È¤Ç¤Ï¡¢ syncookie ¤¬¥µ¡¼¥Ð¡¼¤ÇÍ­¸ú¤Ë¤Ê¤Ã¤Æ¤¤¤ë¾ì¹ç¡¢
355 ¥¿¥¤¥à¥¢¥¦¥È¤¬Èó¾ï¤ËŤ¯¤Ê¤ë¾ì¹ç¤¬¤¢¤ë¤Î¤ÇÃí°Õ¤¹¤ë¤³¤È¡£
356 .\"O .SH "CONFORMING TO"
357 .SH ½àµò
358 .\"O SVr4, 4.4BSD, (the
359 .\"O .BR connect ()
360 .\"O function first appeared in 4.2BSD), POSIX.1-2001.
361 .\"O .\" SVr4 documents the additional
362 .\"O .\" general error codes
363 .\"O .\" .BR EADDRNOTAVAIL ,
364 .\"O .\" .BR EINVAL ,
365 .\"O .\" .BR EAFNOSUPPORT ,
366 .\"O .\" .BR EALREADY ,
367 .\"O .\" .BR EINTR ,
368 .\"O .\" .BR EPROTOTYPE ,
369 .\"O .\" and
370 .\"O .\" .BR ENOSR .
371 SVr4, 4.4BSD,
372 .RB ( connect ()
373 ´Ø¿ô¤Ï 4.2BSD ¤ÇºÇ½é¤ËÅо줷¤¿), POSIX.1-2001.
374 .\" SVr4 ¤Ç¤Ï¡¢°ìÈÌŪ¤Ê¥¨¥é¡¼¡¦¥³¡¼¥É¤È¤·¤Æ
375 .\" .BR EADDRNOTAVAIL ,
376 .\" .BR EINVAL ,
377 .\" .BR EAFNOSUPPORT ,
378 .\" .BR EALREADY ,
379 .\" .BR EINTR ,
380 .\" .BR EPROTOTYPE ,
381 .\" .B ENOSR
382 .\" ¤¬Äɲ䵤ì¤Æ¤¤¤ë¡£
383 .\"O .\" It also
384 .\"O .\" documents many additional error conditions not described here.
385 .\" ¤Þ¤¿¡¢Ëܥޥ˥奢¥ë¤Ë¤Ïµ­ºÜ¤·¤Æ¤¤¤Ê¤¤ÄɲäΥ¨¥é¡¼¾ò·ï¤¬Â¿¤¯µ­ºÜ¤µ¤ì¤Æ¤¤¤ë¡£
386 .\"O .SH NOTES
387 .SH Ãí°Õ
388 .\"O POSIX.1-2001 does not require the inclusion of
389 .\"O .IR <sys/types.h> ,
390 .\"O and this header file is not required on Linux.
391 .\"O However, some historical (BSD) implementations required this header
392 .\"O file, and portable applications are probably wise to include it.
393 POSIX.1-2001 ¤Ç¤Ï
394 .I <sys/types.h>
395 ¤Î¥¤¥ó¥¯¥ë¡¼¥É¤Ïɬ¿Ü¤È¤µ¤ì¤Æ¤ª¤é¤º¡¢
396 Linux ¤Ç¤Ï¤³¤Î¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤ÏɬÍפǤϤʤ¤¡£
397 ¤·¤«¤·¡¢Îò»ËŪ¤Ë¤Ï¡¢¤¤¤¯¤Ä¤«¤Î¼ÂÁõ (BSD ·Ï) ¤Ç¤³¤Î¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤¬
398 ɬÍפǤ¢¤ê¡¢°Ü¿¢À­¤¬É¬Íפʥ¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ç¤Ï¤³¤Î¥Õ¥¡¥¤¥ë¤ò
399 ¥¤¥ó¥¯¥ë¡¼¥É¤¹¤ë¤Î¤¬¸­ÌÀ¤Ç¤¢¤í¤¦¡£
400
401 .\"O The third argument of
402 .\"O .BR connect ()
403 .\"O is in reality an
404 .\"O .I int
405 .\"O (and this is what 4.x BSD and libc4 and libc5 have).
406 .\"O Some POSIX confusion resulted in the present
407 .\"O .IR socklen_t ,
408 .\"O also used by glibc.
409 .\"O See also
410 .\"O .BR accept (2).
411 .BR connect ()
412 ¤Î»°ÈÖÌܤΰú¤­¿ô¤Ï 4.x BSD ¤ä libc4, libc5 ¤ÈƱÍͤ˼ºݤˤÏ
413 .I int
414 ¤Ç¤¢¤ë¡£
415 POSIX ¤Ç¤Ïäþ;¶ÊÀÞ¤ò·Ð¤Æ¸½ºß¤Î
416 .I socklen_t
417 ¤Ë¤Ê¤Ã¤Æ¤ª¤ê¡¢
418 glibc ¤Ç¤â
419 .I socklen_t
420 ¤ò»È¤Ã¤Æ¤¤¤ë¡£
421 .BR accept (2)
422 ¤â»²¾È¤Î¤³¤È¡£
423 .\"O .SH EXAMPLE
424 .SH Îã
425 .\"O An example of the use of
426 .\"O .BR connect ()
427 .\"O is shown in
428 .\"O .BR getaddrinfo (3).
429 .BR connect ()
430 ¤ÎÍøÍÑÎ㤬
431 .BR getaddrinfo (3)
432 ¤Ëµ­ºÜ¤µ¤ì¤Æ¤¤¤ë¡£
433 .\"O .SH "SEE ALSO"
434 .SH ´ØÏ¢¹àÌÜ
435 .BR accept (2),
436 .BR bind (2),
437 .BR getsockname (2),
438 .BR listen (2),
439 .BR socket (2),
440 .BR path_resolution (7)