OSDN Git Service

(split) LDP: Restore and add Copyrights for draft pages
[linuxjm/LDP_man-pages.git] / draft / man2 / connect.2
index 6030456..dc1ee63 100644 (file)
@@ -1,9 +1,8 @@
-.\" Hey Emacs! This file is -*- nroff -*- source.
-.\"
 .\" 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.
 .\"
 .\" 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.
 .\"
+.\" %%%LICENSE_START(VERBATIM)
 .\" Permission is granted to make and distribute verbatim copies of this
 .\" manual provided the copyright notice and this permission notice are
 .\" preserved on all copies.
 .\" Permission is granted to make and distribute verbatim copies of this
 .\" manual provided the copyright notice and this permission notice are
 .\" preserved on all copies.
@@ -23,6 +22,7 @@
 .\"
 .\" Formatted or processed versions of this manual, if unaccompanied by
 .\" the source, must acknowledge the copyright and authors of this work.
 .\"
 .\" Formatted or processed versions of this manual, if unaccompanied by
 .\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
 .\"
 .\"
 .\" Other portions are from the 6.9 (Berkeley) 3/10/91 man page:
 .\"
 .\"
 .\" Other portions are from the 6.9 (Berkeley) 3/10/91 man page:
@@ -30,6 +30,7 @@
 .\" Copyright (c) 1983 The Regents of the University of California.
 .\" All rights reserved.
 .\"
 .\" Copyright (c) 1983 The Regents of the University of California.
 .\" All rights reserved.
 .\"
+.\" %%%LICENSE_START(BSD_4_CLAUSE_UCB)
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
 .\" are met:
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
 .\" are met:
 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
+.\" %%%LICENSE_END
 .\"
 .\" Modified 1997-01-31 by Eric S. Raymond <esr@thyrsus.com>
 .\" Modified 1998, 1999 by Andi Kleen
 .\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
 .\"
 .\"
 .\" Modified 1997-01-31 by Eric S. Raymond <esr@thyrsus.com>
 .\" Modified 1998, 1999 by Andi Kleen
 .\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
 .\"
+.\"*******************************************************************
+.\"
+.\" This file was generated with po4a. Translate the source file.
+.\"
+.\"*******************************************************************
+.\"
 .\" Japanese Version Copyright (c) 1996 Yosiaki Yanagihara
 .\"         all rights reserved.
 .\" Translated 1996-06-25, Yosiaki Yanagihara <yosiaki@bsd2.kbnes.nec.co.jp>
 .\" Japanese Version Copyright (c) 1996 Yosiaki Yanagihara
 .\"         all rights reserved.
 .\" Translated 1996-06-25, Yosiaki Yanagihara <yosiaki@bsd2.kbnes.nec.co.jp>
 .\" Updated & Modified 2005-02-23, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
 .\" Updated & Modified 2005-10-05, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
 .\"
 .\" Updated & Modified 2005-02-23, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
 .\" Updated & Modified 2005-10-05, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
 .\"
-.TH CONNECT 2 2008-12-03 "Linux" "Linux Programmer's Manual"
-.\"O .SH NAME
-.SH Ì¾Á°
-.\"O connect \- initiate a connection on a socket
-connect \- ¥½¥±¥Ã¥È¤ÎÀܳ¤ò¹Ô¤¦
-.\"O .SH SYNOPSIS
-.SH ½ñ¼°
+.TH CONNECT 2 2008\-12\-03 Linux "Linux Programmer's Manual"
+.SH 名前
+connect \- ソケットの接続を行う
+.SH 書式
 .nf
 .nf
-.\"O .BR "#include <sys/types.h>" "          /* See NOTES */"
-.BR "#include <sys/types.h>" "          /* ¡ÖÃí°Õ¡×»²¾È */"
+\fB#include <sys/types.h>\fP          /* 「注意」参照 */
 .br
 .br
-.B #include <sys/socket.h>
+\fB#include <sys/socket.h>\fP
 .sp
 .sp
-.BI "int connect(int " sockfd ", const struct sockaddr *" addr ,
-.BI "            socklen_t " addrlen );
+\fBint connect(int \fP\fIsockfd\fP\fB, const struct sockaddr *\fP\fIaddr\fP\fB,\fP
+\fB            socklen_t \fP\fIaddrlen\fP\fB);\fP
 .fi
 .fi
-.\"O .SH DESCRIPTION
-.SH ÀâÌÀ
-.\"O The
-.\"O .BR connect ()
-.\"O system call connects the socket referred to by the file descriptor
-.\"O .I sockfd
-.\"O to the address specified by
-.\"O .IR addr .
-.\"O The
-.\"O .I addrlen
-.\"O argument specifies the size of
-.\"O .IR addr .
-.\"O The format of the address in
-.\"O .I addr
-.\"O is determined by the address space of the socket
-.\"O .IR sockfd ;
-.\"O see
-.\"O .BR socket (2)
-.\"O for further details.
-.BR connect ()
-¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¡¢¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿
-.I sockfd
-¤¬»²¾È¤·¤Æ¤¤¤ë¥½¥±¥Ã¥È¤ò
-.I addr
-¤Ç»ØÄꤵ¤ì¤¿¥¢¥É¥ì¥¹¤ËÀܳ¤¹¤ë¡£
-.I addrlen
-°ú¤­¿ô¤Ï
-.I addr
-¤ÎÂ礭¤µ¤ò¼¨¤¹¡£
-.I addr
-¤Î¥¢¥É¥ì¥¹¤Î¥Õ¥©¡¼¥Þ¥Ã¥È¤Ï¥½¥±¥Ã¥È
-.I sockfd
-¤Î¥¢¥É¥ì¥¹¶õ´Ö¤Ë¤è¤ê°Û¤Ê¤ë¡£
-¤µ¤é¤Ê¤ë¾ÜºÙ¤Ï
-.BR socket (2)
-¤ò»²¾È¤Î¤³¤È¡£
+.SH 説明
+\fBconnect\fP()  システムコールは、ファイルディスクリプタ \fIsockfd\fP が参照しているソケットを \fIaddr\fP
+で指定されたアドレスに接続する。 \fIaddrlen\fP 引き数は \fIaddr\fP の大きさを示す。 \fIaddr\fP のアドレスのフォーマットはソケット
+\fIsockfd\fP のアドレス空間により異なる。 さらなる詳細は \fBsocket\fP(2)  を参照のこと。
 
 
-.\"O If the socket
-.\"O .I sockfd
-.\"O is of type
-.\"O .B SOCK_DGRAM
-.\"O then
-.\"O .I addr
-.\"O is the address to which datagrams are sent by default, and the only
-.\"O address from which datagrams are received.
-.\"O If the socket is of type
-.\"O .B SOCK_STREAM
-.\"O or
-.\"O .BR SOCK_SEQPACKET ,
-.\"O this call attempts to make a connection to the socket that is bound
-.\"O to the address specified by
-.\"O .IR addr .
-¥½¥±¥Ã¥È
-.I sockfd
-¤¬
-.B SOCK_DGRAM
-·¿¤Ç¤¢¤ì¤Ð¡¢
-.I addr
-¤Ï¡¢¥Ç¥Õ¥©¥ë¥È¤Î¥Ç¡¼¥¿¥°¥é¥à¤ÎÁ÷¿®Àè¤Î¥¢¥É¥ì¥¹¤Ç¤¢¤ê¡¢
-¥Ç¡¼¥¿¥°¥é¥à¤ò¼õ¿®¤¹¤ëÍ£°ì¤Î¥¢¥É¥ì¥¹¤ò¼¨¤¹¤Ë²á¤®¤Ê¤¤¡£
-¥½¥±¥Ã¥È¤¬
-.B SOCK_STREAM
-·¿¤â¤·¤¯¤Ï
-.B SOCK_SEQPACKET
-·¿¤Ç¤¢¤ì¤Ð¡¢¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï
-.I addr
-¤Ç»ØÄꤵ¤ì¤¿¥¢¥É¥ì¥¹¤Ë·ë¤ÓÉÕ¤±¤é¤ì¤¿¥½¥±¥Ã¥È¤ËÂФ¹¤ëÀܳ¤Î
-ºîÀ®¤ò»î¤ß¤ë¡£
+ソケット \fIsockfd\fP が \fBSOCK_DGRAM\fP 型であれば、 \fIaddr\fP は、デフォルトのデータグラムの送信先のアドレスであり、
+データグラムを受信する唯一のアドレスを示すに過ぎない。 ソケットが \fBSOCK_STREAM\fP 型もしくは \fBSOCK_SEQPACKET\fP
+型であれば、このシステムコールは \fIaddr\fP で指定されたアドレスに結び付けられたソケットに対する接続の 作成を試みる。
 .PP
 .PP
-.\"O Generally, connection-based protocol sockets may successfully
-.\"O .BR connect ()
-.\"O only once; connectionless protocol sockets may use
-.\"O .BR connect ()
-.\"O multiple times to change their association.
-.\"O Connectionless sockets may
-.\"O dissolve the association by connecting to an address with the
-.\"O .I sa_family
-.\"O member of
-.\"O .I sockaddr
-.\"O set to
-.\"O .BR AF_UNSPEC
-.\"O (supported on Linux since kernel 2.2).
-°ìÈÌŪ¤Ë¡¢Àܳ»Ø¸þ (connection-oriented) ¥×¥í¥È¥³¥ë¤Ç¤Ï°ìÅÙ¤À¤±
-.BR connect ()
-¤¬À®¸ù¤¹¤ë¡£
-ÈóÀܳ (connectionless) ¥×¥í¥È¥³¥ë¤Ç¤ÏÂбþ¤òÊѹ¹¤¹¤ë¤¿¤á¤Ë²¿ÅÙ¤â
-.BR connect ()
-¤ò»ÈÍѤǤ­¤ë¡£
-ÈóÀܳ¥½¥±¥Ã¥È¤Ï
-.I sockaddr
-¤Î
-.I sa_family
-¥á¥ó¥Ð¤Ë
-.B AF_UNSPEC
-¤òÀßÄꤹ¤ë¤³¤È¤Ç¡¢Àܳ¥¢¥É¥ì¥¹¤ÎÂбþ¤ò²ò¾Ã¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë
-.RB ( AF_UNSPEC
-¤Ï¥«¡¼¥Í¥ë 2.2 °Ê¹ß¤Î Linux ¤Ç¥µ¥Ý¡¼¥È)¡£
-.\"O .SH "RETURN VALUE"
-.SH ÊÖ¤êÃÍ
-.\"O If the connection or binding succeeds, zero is returned.
-.\"O On error, \-1 is
-.\"O returned, and
-.\"O .I errno
-.\"O is set appropriately.
-Àܳ¤Þ¤¿¤ÏÂбþ¤Å¤±¤ËÀ®¸ù¤¹¤ë¤È¥¼¥í¤òÊÖ¤¹¡£
-¼ºÇÔ¤¹¤ë¤È \-1 ¤òÊÖ¤·¡¢
-.I errno
-¤ËŬÀÚ¤ÊÃͤòÀßÄꤹ¤ë¡£
-.\"O .SH ERRORS
-.SH ¥¨¥é¡¼
-.\"O The following are general socket errors only.
-.\"O There may be other domain-specific error codes.
-°Ê²¼¤Ï°ìÈÌŪ¤Ê¥½¥±¥Ã¥È¤Ë¤Ä¤¤¤Æ¤Î¥¨¥é¡¼¤Ç¤¢¤ë¡£Â¾¤Ë¥É¥á¥¤¥óÆÃÍ­¤Î¥¨¥é¡¼
-¤¬È¯À¸¤¹¤ë²ÄǽÀ­¤¬¤¢¤ë¡£
-.TP
-.B EACCES
-.\"O For Unix domain sockets, which are identified by pathname:
-.\"O Write permission is denied on the socket file,
-.\"O or search permission is denied for one of the directories
-.\"O in the path prefix.
-.\"O (See also
-.\"O .BR path_resolution (7).)
-Unix ¥É¥á¥¤¥ó¥½¥±¥Ã¥È¤Ï¥Ñ¥¹Ì¾¤Ç¼±Ê̤µ¤ì¤ë¡£
-¥½¥±¥Ã¥È¡¦¥Õ¥¡¥¤¥ë¤Ø¤Î½ñ¤­¹þ¤ßµö²Ä¤¬¤Ê¤«¤Ã¤¿¤«¡¢¥Ñ¥¹Ì¾¤Ø
-Åþ㤹¤ë¤Þ¤Ç¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Î¤¤¤º¤ì¤«¤ËÂФ¹¤ë¸¡º÷µö²Ä¤¬¤Ê¤«¤Ã¤¿¡£
-.RB ( path_resolution (7)
-¤â»²¾È¤Î¤³¤È)
-.TP
-.BR EACCES ", " EPERM
-.\"O The user tried to connect to a broadcast address without having the socket
-.\"O broadcast flag enabled or the connection request failed because of a local
-.\"O firewall rule.
-¥½¥±¥Ã¥È¤Î¥Ö¥í¡¼¥É¥­¥ã¥¹¥È¡¦¥Õ¥é¥°¤¬Í­¸ú¤Ë¤Ê¤Ã¤Æ¤¤¤Ê¤¤¤Î¤Ë
-¥æ¡¼¥¶¤¬¥Ö¥í¡¼¥É¥­¥ã¥¹¥È¤ØÀܳ¤ò»î¤ß¤¿¡£¤Þ¤¿¤Ï¡¢¥í¡¼¥«¥ë¤Î¥Õ¥¡¥¤¥¢¥¦¥©¡¼¥ë¤Î
-µ¬Â§¤Ë¤è¤êÀܳ¤ÎÍ׵᤬¼ºÇÔ¤·¤¿¡£
-.TP
-.B EADDRINUSE
-.\"O Local address is already in use.
-¥í¡¼¥«¥ë¥¢¥É¥ì¥¹¤¬´û¤Ë»ÈÍѤµ¤ì¤Æ¤¤¤ë¡£
-.TP
-.B EAFNOSUPPORT
-.\"O The passed address didn't have the correct address family in its
-.\"O .I sa_family
-.\"O field.
-ÅϤµ¤ì¤¿¥¢¥É¥ì¥¹¤Î
-.I sa_family
-¥Õ¥£¡¼¥ë¥É¤¬Àµ¤·¤¤¥¢¥É¥ì¥¹¡¦¥Õ¥¡¥ß¥ê¡¼¤Ç¤Ï¤Ê¤¤¡£
-.TP
-.B EAGAIN
-.\"O No more free local ports or insufficient entries in the routing cache.
-.\"O For
-.\"O .B AF_INET
-.\"O see the description of
-.\"O .I /proc/sys/net/ipv4/ip_local_port_range
-.\"O .BR ip (7)
-.\"O for information on how to increase the number of local ports.
-»ÈÍѲÄǽ¤Ê¥í¡¼¥«¥ë¤Î¥Ý¡¼¥È¤¬¤Ê¤¤¤«¡¢
-¥ë¡¼¥Æ¥£¥ó¥°¥­¥ã¥Ã¥·¥å¤Ë½½Ê¬¤Ê¥¨¥ó¥È¥ê¤¬¤Ê¤¤¡£
-.B AF_INET
-¤Î¾ì¹ç¤Ë¡¢¥í¡¼¥«¥ë¥Ý¡¼¥È¤Î¿ô¤òÁý¤ä¤¹ÊýË¡¤Ë¤Ä¤¤¤Æ¤Ï¡¢
-.BR ip (7)
-¤Î
-.I /proc/sys/net/ipv4/ip_local_port_range
-¤ÎÀâÌÀ¤ò»²¾È¤Î¤³¤È¡£
-.TP
-.B EALREADY
-.\"O The socket is nonblocking and a previous connection attempt has not yet
-.\"O been completed.
-¥½¥±¥Ã¥È¤¬ÈóÄä»ß (nonblocking) ¤ËÀßÄꤵ¤ì¤Æ¤ª¤ê¡¢
-Á°¤ÎÀܳ¤¬´°Î»¤·¤Æ¤¤¤Ê¤¤¡£
-.TP
-.B EBADF
-.\"O The file descriptor is not a valid index in the descriptor table.
-¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼¤¬¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼¥Æ¡¼¥Ö¥ë¤Î
-Í­¸ú¤Ê¥¤¥ó¥Ç¥Ã¥¯¥¹¤Ç¤Ï¤Ê¤¤¡£
-.TP
-.B ECONNREFUSED
-.\"O No-one listening on the remote address.
-¥ê¥â¡¼¥È¥¢¥É¥ì¥¹¤ÇÀܳ¤òÂԤäƤ¤¤ë¥×¥í¥°¥é¥à¤¬¤Ê¤¤¡£
-.TP
-.B EFAULT
-.\"O The socket structure address is outside the user's address space.
-¥½¥±¥Ã¥È¹½Â¤ÂΤΥ¢¥É¥ì¥¹¤¬¥æ¡¼¥¶¡¼¤Î¥¢¥É¥ì¥¹¶õ´Ö³°¤Ë¤¢¤ë¡£
-.TP
-.B EINPROGRESS
-.\"O The socket is nonblocking and the connection cannot be completed
-.\"O immediately.  It is possible to
-.\"O .BR select (2)
-.\"O or
-.\"O .BR poll (2)
-.\"O for completion by selecting the socket for writing.
-.\"O After
-.\"O .BR select (2)
-.\"O indicates writability, use
-.\"O .BR getsockopt (2)
-.\"O to read the
-.\"O .B SO_ERROR
-.\"O option at level
-.\"O .B SOL_SOCKET
-.\"O to determine whether
-.\"O .BR connect ()
-.\"O completed successfully
-.\"O .RB ( SO_ERROR
-.\"O is zero) or unsuccessfully
-.\"O .RB ( SO_ERROR
-.\"O is one of the usual error codes listed here,
-.\"O explaining the reason for the failure).
-¥½¥±¥Ã¥È¤¬ÈóÄä»ß (nonblocking) ¤ËÀßÄꤵ¤ì¤Æ¤¤¤Æ¡¢Àܳ¤ò¤¹¤°¤Ë
-´°Î»¤¹¤ë¤³¤È¤¬¤Ç¤­¤Ê¤¤¡£¤½¤Î¾ì¹ç¡¢
-.BR select (2)
-¤ä
-.BR poll (2)
-¤ò»È¤Ã¤Æ¤½¤Î¥½¥±¥Ã¥È¤¬½ñ¤­¹þ¤ß²Äǽ¤Ë¤Ê¤ë¤Î¤òÂԤĤ³¤È¤Ç¡¢
-Àܳ¤Î´°Î»¤òÃΤ뤳¤È¤¬¤Ç¤­¤ë¡£
-.BR select (2)
-¤Ç½ñ¤­¹þ¤ß²Äǽ¤Ë¤Ê¤Ã¤¿¸å¤Ë¡¢
-.BR getsockopt (2)
-¤ò»È¤Ã¤Æ
-.B SOL_SOCKET
-¥ì¥Ù¥ë¤Ç
-.B SO_ERROR
-¥ª¥×¥·¥ç¥ó¤òÆɤ߽Ф¹¤³
-¤È¤Ë¤è¤ê¡¢
-.BR connect ()
-¤¬À®¸ù¤·¤¿¤«¡¢¼ºÇÔ¤·¤¿¤«¤òȽÃǤǤ­¤ë¡£
-À®¸ù¤Î¾ì¹ç
-.B SO_ERROR
-¤¬ 0 ¤Ç¤¢¤ê¡¢
-¼ºÇԤξì¹ç
-.B SO_ERROR
-¤¬¤³¤³¤Î¥ê¥¹¥È¤Ë¤¢¤ë¤¤¤º¤ì¤«¤Î¥¨¥é¡¼¥³¡¼¥É¤Ç¤¢¤ê¡¢
-¤½¤ì¤Ë¤è¤ê¼ºÇԤθ¶°ø¤¬Ê¬¤«¤ë¡£
-.TP
-.B EINTR
-.\"O The system call was interrupted by a signal that was caught; see
-.\"O .BR signal (7).
-.\"O .\" For TCP, the connection will complete asynchronously.
-.\"O .\" See http://lkml.org/lkml/2005/7/12/254
-Ê᪤µ¤ì¤¿¥·¥°¥Ê¥ë¤Ë¤è¤ê¥·¥¹¥Æ¥à¥³¡¼¥ë¤¬ÃæÃǤµ¤ì¤¿¡£
-.BR signal (7)
-»²¾È¡£
-.\" TCP ¤Î¾ì¹ç¤Ï¡¢Àܳ½èÍý¤ÏÈóƱ´ü¤Ë¤Ê¤ë¤¬´°Î»¤¹¤ë¤À¤í¤¦¡£
-.\" http://lkml.org/lkml/2005/7/12/254 ¤ò»²¾È¤Î¤³¤È¡£
-.TP
-.B EISCONN
-.\"O The socket is already connected.
-¥½¥±¥Ã¥È¤Ï´û¤ËÀܳ (connect) ¤µ¤ì¤Æ¤¤¤ë¡£
-.TP
-.B ENETUNREACH
-.\"O Network is unreachable.
-Åþã¤Ç¤­¤Ê¤¤¥Í¥Ã¥È¥ï¡¼¥¯¤Ç¤¢¤ë¡£
-.TP
-.B ENOTSOCK
-.\"O The file descriptor is not associated with a socket.
-¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼¤¬¥½¥±¥Ã¥È¤È´ØÏ¢ÉÕ¤±¤é¤ì¤Æ¤¤¤Ê¤¤¡£
-.TP
-.B ETIMEDOUT
-.\"O Timeout while attempting connection.
-.\"O The server may be too
-.\"O busy to accept new connections.
-.\"O Note that for IP sockets the timeout may
-.\"O be very long when syncookies are enabled on the server.
-Àܳ¤ò»î¤ß¤Æ¤¤¤ëÅÓÃæ¤Ç»þ´ÖÀÚ¤ì (timeout) ¤Ë¤Ê¤Ã¤¿¡£¥µ¡¼¥Ð¡¼¤¬º®»¨¤·¤Æ¤¤¤Æ
-¿·¤¿¤ÊÀܳ¤ò¼õ¤±Æþ¤ì¤é¤ì¤Ê¤¤¤Î¤«¤â¤·¤ì¤Ê¤¤¡£
-IP ¥½¥±¥Ã¥È¤Ç¤Ï¡¢ syncookie ¤¬¥µ¡¼¥Ð¡¼¤ÇÍ­¸ú¤Ë¤Ê¤Ã¤Æ¤¤¤ë¾ì¹ç¡¢
-¥¿¥¤¥à¥¢¥¦¥È¤¬Èó¾ï¤ËŤ¯¤Ê¤ë¾ì¹ç¤¬¤¢¤ë¤Î¤ÇÃí°Õ¤¹¤ë¤³¤È¡£
-.\"O .SH "CONFORMING TO"
-.SH ½àµò
-.\"O SVr4, 4.4BSD, (the
-.\"O .BR connect ()
-.\"O function first appeared in 4.2BSD), POSIX.1-2001.
-.\"O .\" SVr4 documents the additional
-.\"O .\" general error codes
-.\"O .\" .BR EADDRNOTAVAIL ,
-.\"O .\" .BR EINVAL ,
-.\"O .\" .BR EAFNOSUPPORT ,
-.\"O .\" .BR EALREADY ,
-.\"O .\" .BR EINTR ,
-.\"O .\" .BR EPROTOTYPE ,
-.\"O .\" and
-.\"O .\" .BR ENOSR .
-SVr4, 4.4BSD,
-.RB ( connect ()
-´Ø¿ô¤Ï 4.2BSD ¤ÇºÇ½é¤ËÅо줷¤¿), POSIX.1-2001.
-.\" SVr4 ¤Ç¤Ï¡¢°ìÈÌŪ¤Ê¥¨¥é¡¼¡¦¥³¡¼¥É¤È¤·¤Æ
+一般的に、接続指向 (connection\-oriented) プロトコルでは一度だけ \fBconnect\fP()  が成功する。 コネクションレス
+(connectionless) プロトコルでは対応を変更するために何度も \fBconnect\fP()  を使用できる。 非接続ソケットは
+\fIsockaddr\fP の \fIsa_family\fP メンバに \fBAF_UNSPEC\fP を設定することで、接続アドレスの対応を解消することができる
+(\fBAF_UNSPEC\fP はカーネル 2.2 以降の Linux でサポート)。
+.SH 返り値
+接続または対応づけに成功するとゼロを返す。 失敗すると \-1 を返し、 \fIerrno\fP に適切な値を設定する。
+.SH エラー
+以下は一般的なソケットについてのエラーである。他にドメイン特有のエラー が発生する可能性がある。
+.TP 
+\fBEACCES\fP
+UNIX ドメインソケットはパス名で識別される。 ソケット・ファイルへの書き込み許可がなかったか、パス名へ
+到達するまでのディレクトリのいずれかに対する検索許可がなかった。 (\fBpath_resolution\fP(7)  も参照のこと)
+.TP 
+\fBEACCES\fP, \fBEPERM\fP
+ソケットのブロードキャスト・フラグが有効になっていないのに ユーザがブロードキャストへ接続を試みた。または、ローカルのファイアウォールの
+規則により接続の要求が失敗した。
+.TP 
+\fBEADDRINUSE\fP
+ローカルアドレスが既に使用されている。
+.TP 
+\fBEAFNOSUPPORT\fP
+渡されたアドレスの \fIsa_family\fP フィールドが正しいアドレス・ファミリーではない。
+.TP 
+\fBEAGAIN\fP
+使用可能なローカルのポートがないか、 ルーティングキャッシュに十分なエントリがない。 \fBAF_INET\fP
+の場合に、ローカルポートの数を増やす方法については、 \fBip\fP(7)  の
+\fI/proc/sys/net/ipv4/ip_local_port_range\fP の説明を参照のこと。
+.TP 
+\fBEALREADY\fP
+ソケットが非停止 (nonblocking) に設定されており、 前の接続が完了していない。
+.TP 
+\fBEBADF\fP
+ファイルディスクリプターがディスクリプターテーブルの 有効なインデックスではない。
+.TP 
+\fBECONNREFUSED\fP
+リモートアドレスで接続を待っているプログラムがない。
+.TP 
+\fBEFAULT\fP
+ソケット構造体のアドレスがユーザーのアドレス空間外にある。
+.TP 
+\fBEINPROGRESS\fP
+ソケットが非停止 (nonblocking) に設定されていて、接続をすぐに 完了することができない。その場合、 \fBselect\fP(2)  や
+\fBpoll\fP(2)  を使ってそのソケットが書き込み可能になるのを待つことで、 接続の完了を知ることができる。 \fBselect\fP(2)
+で書き込み可能になった後に、 \fBgetsockopt\fP(2)  を使って \fBSOL_SOCKET\fP レベルで \fBSO_ERROR\fP
+オプションを読み出すこ とにより、 \fBconnect\fP()  が成功したか、失敗したかを判断できる。 成功の場合 \fBSO_ERROR\fP が 0
+であり、 失敗の場合 \fBSO_ERROR\fP がここのリストにあるいずれかのエラーコードであり、 それにより失敗の原因が分かる。
+.TP 
+\fBEINTR\fP
+.\" For TCP, the connection will complete asynchronously.
+.\" See http://lkml.org/lkml/2005/7/12/254
+捕捉されたシグナルによりシステムコールが中断された。 \fBsignal\fP(7)  参照。
+.TP 
+\fBEISCONN\fP
+ソケットは既に接続 (connect) されている。
+.TP 
+\fBENETUNREACH\fP
+到達できないネットワークである。
+.TP 
+\fBENOTSOCK\fP
+ファイルディスクリプターがソケットと関連付けられていない。
+.TP 
+\fBETIMEDOUT\fP
+接続を試みている途中で時間切れ (timeout) になった。サーバーが混雑していて 新たな接続を受け入れられないのかもしれない。 IP ソケットでは、
+syncookie がサーバーで有効になっている場合、 タイムアウトが非常に長くなる場合があるので注意すること。
+.SH 準拠
+.\" SVr4 documents the additional
+.\" general error codes
 .\" .BR EADDRNOTAVAIL ,
 .\" .BR EINVAL ,
 .\" .BR EAFNOSUPPORT ,
 .\" .BR EALREADY ,
 .\" .BR EINTR ,
 .\" .BR EPROTOTYPE ,
 .\" .BR EADDRNOTAVAIL ,
 .\" .BR EINVAL ,
 .\" .BR EAFNOSUPPORT ,
 .\" .BR EALREADY ,
 .\" .BR EINTR ,
 .\" .BR EPROTOTYPE ,
-.\" .B ENOSR
-.\" ¤¬Äɲ䵤ì¤Æ¤¤¤ë¡£
-.\"O .\" It also
-.\"O .\" documents many additional error conditions not described here.
-.\" ¤Þ¤¿¡¢Ëܥޥ˥奢¥ë¤Ë¤Ïµ­ºÜ¤·¤Æ¤¤¤Ê¤¤ÄɲäΥ¨¥é¡¼¾ò·ï¤¬Â¿¤¯µ­ºÜ¤µ¤ì¤Æ¤¤¤ë¡£
-.\"O .SH NOTES
-.SH Ãí°Õ
-.\"O POSIX.1-2001 does not require the inclusion of
-.\"O .IR <sys/types.h> ,
-.\"O and this header file is not required on Linux.
-.\"O However, some historical (BSD) implementations required this header
-.\"O file, and portable applications are probably wise to include it.
-POSIX.1-2001 ¤Ç¤Ï
-.I <sys/types.h>
-¤Î¥¤¥ó¥¯¥ë¡¼¥É¤Ïɬ¿Ü¤È¤µ¤ì¤Æ¤ª¤é¤º¡¢
-Linux ¤Ç¤Ï¤³¤Î¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤ÏɬÍפǤϤʤ¤¡£
-¤·¤«¤·¡¢Îò»ËŪ¤Ë¤Ï¡¢¤¤¤¯¤Ä¤«¤Î¼ÂÁõ (BSD ·Ï) ¤Ç¤³¤Î¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤¬
-ɬÍפǤ¢¤ê¡¢°Ü¿¢À­¤¬É¬Íפʥ¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ç¤Ï¤³¤Î¥Õ¥¡¥¤¥ë¤ò
-¥¤¥ó¥¯¥ë¡¼¥É¤¹¤ë¤Î¤¬¸­ÌÀ¤Ç¤¢¤í¤¦¡£
+.\" and
+.\" .BR ENOSR .
+.\" It also
+.\" documents many additional error conditions not described here.
+SVr4, 4.4BSD, (\fBconnect\fP()  関数は 4.2BSD で最初に登場した), POSIX.1\-2001.
+.SH 注意
+POSIX.1\-2001 では \fI<sys/types.h>\fP のインクルードは必須とされておらず、 Linux
+ではこのヘッダファイルは必要ではない。 しかし、歴史的には、いくつかの実装 (BSD 系) でこのヘッダファイルが
+必要であり、移植性が必要なアプリケーションではこのファイルを インクルードするのが賢明であろう。
 
 
-.\"O The third argument of
-.\"O .BR connect ()
-.\"O is in reality an
-.\"O .I int
-.\"O (and this is what 4.x BSD and libc4 and libc5 have).
-.\"O Some POSIX confusion resulted in the present
-.\"O .IR socklen_t ,
-.\"O also used by glibc.
-.\"O See also
-.\"O .BR accept (2).
-.BR connect ()
-¤Î»°ÈÖÌܤΰú¤­¿ô¤Ï 4.x BSD ¤ä libc4, libc5 ¤ÈƱÍͤ˼ºݤˤÏ
-.I int
-¤Ç¤¢¤ë¡£
-POSIX ¤Ç¤Ïäþ;¶ÊÀÞ¤ò·Ð¤Æ¸½ºß¤Î
-.I socklen_t
-¤Ë¤Ê¤Ã¤Æ¤ª¤ê¡¢
-glibc ¤Ç¤â
-.I socklen_t
-¤ò»È¤Ã¤Æ¤¤¤ë¡£
-.BR accept (2)
-¤â»²¾È¤Î¤³¤È¡£
-.\"O .SH EXAMPLE
-.SH Îã
-.\"O An example of the use of
-.\"O .BR connect ()
-.\"O is shown in
-.\"O .BR getaddrinfo (3).
-.BR connect ()
-¤ÎÍøÍÑÎ㤬
-.BR getaddrinfo (3)
-¤Ëµ­ºÜ¤µ¤ì¤Æ¤¤¤ë¡£
-.\"O .SH "SEE ALSO"
-.SH ´ØÏ¢¹àÌÜ
-.BR accept (2),
-.BR bind (2),
-.BR getsockname (2),
-.BR listen (2),
-.BR socket (2),
-.BR path_resolution (7)
+\fBconnect\fP()  の三番目の引き数は 4.x BSD や libc4, libc5 と同様に実際には \fIint\fP である。 POSIX
+では紆余曲折を経て現在の \fIsocklen_t\fP になっており、 glibc でも \fIsocklen_t\fP を使っている。 \fBaccept\fP(2)
+も参照のこと。
+.SH 例
+\fBconnect\fP()  の利用例が \fBgetaddrinfo\fP(3)  に記載されている。
+.SH 関連項目
+\fBaccept\fP(2), \fBbind\fP(2), \fBgetsockname\fP(2), \fBlisten\fP(2), \fBsocket\fP(2),
+\fBpath_resolution\fP(7)
+.SH この文書について
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部
+である。プロジェクトの説明とバグ報告に関する情報は
+http://www.kernel.org/doc/man\-pages/ に書かれている。