Submitted by: Akira Ikeuchi <a_ikeuchi@mic.mitsumi.co.jp> Reviewed by: Watanabe Kazuhiro <CQG00620@nifty.ne.jp>
157 lines
5.1 KiB
Groff
157 lines
5.1 KiB
Groff
.\" Copyright (c) 1983, 1993
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, are permitted provided that the following conditions
|
|
.\" are met:
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
.\" must display the following acknowledgement:
|
|
.\" This product includes software developed by the University of
|
|
.\" California, Berkeley and its contributors.
|
|
.\" 4. Neither the name of the University nor the names of its contributors
|
|
.\" may be used to endorse or promote products derived from this software
|
|
.\" without specific prior written permission.
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
.\" 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.
|
|
.\"
|
|
.\" @(#)connect.2 8.1 (Berkeley) 6/4/93
|
|
.\" %FreeBSD: src/lib/libc/sys/connect.2,v 1.26 2004/07/02 19:07:30 ru Exp %
|
|
.\"
|
|
.\" $FreeBSD$
|
|
.Dd June 4, 1993
|
|
.Dt CONNECT 2
|
|
.Os
|
|
.Sh ̾¾Î
|
|
.Nm connect
|
|
.Nd ¥½¥±¥Ã¥È¾å¤ÇÀܳ¤ò³«»Ï¤¹¤ë
|
|
.Sh ¥é¥¤¥Ö¥é¥ê
|
|
.Lb libc
|
|
.Sh ½ñ¼°
|
|
.In sys/types.h
|
|
.In sys/socket.h
|
|
.Ft int
|
|
.Fn connect "int s" "const struct sockaddr *name" "socklen_t namelen"
|
|
.Sh ²òÀâ
|
|
.Fa s
|
|
°ú¿ô¤Ï¥½¥±¥Ã¥È¤Ç¤¹¡£
|
|
¤³¤Î¥¿¥¤¥×¤¬
|
|
.Dv SOCK_DGRAM
|
|
¤Î¾ì¹ç¡¢¤³¤Î¸Æ¤Ó½Ð¤·¤Ï¥½¥±¥Ã¥È¤¬·ë¤ÓÉÕ¤±¤é¤ì¤ë
|
|
ÄÌ¿®Áê¼ê¤ò»ØÄꤷ¤Þ¤¹¡£
|
|
¤³¤Î¥¢¥É¥ì¥¹¤ÏÁ÷¿®¥Ç¡¼¥¿¥°¥é¥à¤ÎÁ÷¿®Àè¤Ç¤¢¤ê¡¢
|
|
¼õ¿®¥Ç¡¼¥¿¥°¥é¥à¤ÎÁ÷¿®¸µ¤È¤Ê¤ëÍ£°ì¤Î¥¢¥É¥ì¥¹¤Ç¤¹¡£
|
|
¥½¥±¥Ã¥È¤Î¥¿¥¤¥×¤¬
|
|
.Dv SOCK_STREAM
|
|
¤Î¾ì¹ç¡¢¤³¤Î¸Æ¤Ó½Ð¤·¤ÏÄÌ¿®Áê¼ê¤Î¥½¥±¥Ã¥È¤ËÀܳ¤ò³ÎΩ
|
|
¤·¤è¤¦¤È¤·¤Þ¤¹¡£
|
|
ÄÌ¿®Áê¼ê¤Î¥½¥±¥Ã¥È¤Ï
|
|
.Fa name
|
|
¤Ç»ØÄꤵ¤ì¤Þ¤¹¡£
|
|
.Fa name
|
|
¤Ï¥½¥±¥Ã¥ÈÄÌ¿®¶õ´ÖÆâ¤Î¥¢¥É¥ì¥¹¤Ç¤¹¡£
|
|
³ÆÄÌ¿®¶õ´Ö¤Ï
|
|
.Fa name
|
|
°ú¿ô¤òÆÈ¼«¤ÎÊýË¡¤Ç²ò¼á¤·¤Þ¤¹¡£
|
|
°ìÈ̤ˡ¢¥¹¥È¥ê¡¼¥à¥½¥±¥Ã¥È¤¬Àµ¾ï¤Ë
|
|
.Fn connect
|
|
¤Ç¤¤ë¤Î¤Ï 1 ²ó¤À¤±¤Ç¤¹¡£
|
|
¥Ç¡¼¥¿¥°¥é¥à¥½¥±¥Ã¥È¤Ï
|
|
.Fn connect
|
|
¤òÊ£¿ô²ó»ÈÍѤ·¤Æ¤½¤Î·ë¤ÓÉÕ¤±¤òÊѹ¹¤Ç¤¤Þ¤¹¡£
|
|
¥Ç¡¼¥¿¥°¥é¥à¥½¥±¥Ã¥È¤Ï¡¢NULL ¥¢¥É¥ì¥¹¤Î¤è¤¦¤Ê̵¸ú¤Ê¥¢¥É¥ì¥¹¤Ë
|
|
Àܳ¤¹¤ë¤³¤È¤Ë¤è¤Ã¤Æ·ë¤ÓÉÕ¤±¤ò²ò½ü¤Ç¤¤Þ¤¹¡£
|
|
.Sh Ìá¤êÃÍ
|
|
.Rv -std connect
|
|
.Sh ¥¨¥é¡¼
|
|
.Fn connect
|
|
¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¼¡¤Î¾ì¹ç¤Ë¼ºÇÔ¤·¤Þ¤¹:
|
|
.Bl -tag -width Er
|
|
.It Bq Er EBADF
|
|
.Fa s
|
|
°ú¿ô¤¬Í¸ú¤Êµ½Ò»Ò¤Ç¤¢¤ê¤Þ¤»¤ó¡£
|
|
.It Bq Er ENOTSOCK
|
|
.Fa s
|
|
°ú¿ô¤¬¥½¥±¥Ã¥È¤Ç¤Ï¤Ê¤¯¥Õ¥¡¥¤¥ë¤Îµ½Ò»Ò¤Ç¤¹¡£
|
|
.It Bq Er EADDRNOTAVAIL
|
|
»ØÄê¤Î¥¢¥É¥ì¥¹¤¬¤³¤Î¥Þ¥·¥ó¤Ç¤ÏÍøÍѤǤ¤Þ¤»¤ó¡£
|
|
.It Bq Er EAFNOSUPPORT
|
|
»ØÄê¤Î¥¢¥É¥ì¥¹¥Õ¥¡¥ß¥êÆâ¤Î¥¢¥É¥ì¥¹¤¬¤³¤Î¥½¥±¥Ã¥È¤Ç¤Ï»ÈÍѤǤ¤Þ¤»¤ó¡£
|
|
.It Bq Er EISCONN
|
|
¥½¥±¥Ã¥È¤Ï´û¤ËÀܳ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
|
|
.It Bq Er ETIMEDOUT
|
|
Àܳ¤ò³ÎΩ¤¹¤ë¤³¤È¤Ê¤¯¡¢¥¿¥¤¥à¥¢¥¦¥È¤·¤Þ¤·¤¿¡£
|
|
.It Bq Er ECONNREFUSED
|
|
Àܳ¤¬¶¯À©Åª¤ËµñÀ䤵¤ì¤Þ¤·¤¿¡£
|
|
.It Bq Er ENETUNREACH
|
|
¤³¤Î¥Û¥¹¥È¤«¤é¤½¤Î¥Í¥Ã¥È¥ï¡¼¥¯¤ËÅþã¤Ç¤¤Þ¤»¤ó¡£
|
|
.It Bq Er EHOSTUNREACH
|
|
¤³¤Î¥Û¥¹¥È¤«¤é¤½¤Î¥ê¥â¡¼¥È¥Û¥¹¥È¤ËÅþã¤Ç¤¤Þ¤»¤ó¡£
|
|
.It Bq Er EADDRINUSE
|
|
¥¢¥É¥ì¥¹¤¬´û¤Ë»ÈÍÑÃæ¤Ç¤¹¡£
|
|
.It Bq Er EFAULT
|
|
.Fa name
|
|
°ú¿ô¤Ï¥×¥í¥»¥¹¥¢¥É¥ì¥¹¶õ´Ö¤Î³°Â¦¤ÎÎΰè¤ò»ØÄꤷ¤Æ¤¤¤Þ¤¹¡£
|
|
.It Bq Er EINPROGRESS
|
|
Èó¥Ö¥í¥Ã¥¥ó¥°¤Î¥½¥±¥Ã¥È¤Ç¡¢Àܳ¤¬¤¹¤°¤Ë¤Ï³ÎΩ¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£
|
|
¥½¥±¥Ã¥È¤Ø¤Î½ñ¹þ¤ß¤ò
|
|
.Xr select 2
|
|
¤ÇÂԤĤ³¤È¤Ë¤è¤Ã¤Æ¡¢Àܳ´°Î»¤òÂԤĤ³¤È¤¬¤Ç¤¤Þ¤¹¡£
|
|
.It Bq Er EINTR
|
|
Àܳ¤Î»î¤ß¤Ï¡¢¥·¥°¥Ê¥ë¤ÎÇÛ¿®¤Ë¤è¤ê³ä¤ê¹þ¤Þ¤ì¤Þ¤·¤¿¡£
|
|
¤½¤ÎÀܳ¤Ï
|
|
.Er EINPROGRESS
|
|
¤Î¾ì¹ç¤ÈƱ¤¸¤è¤¦¤Ë¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¤Ç³ÎΩ¤µ¤ì¤Þ¤¹¡£
|
|
.It Bq Er EALREADY
|
|
Á°¤ÎÀܳ¤Î»î¤ß¤¬Ì¤¤À´°Î»¤·¤Æ¤¤¤Þ¤»¤ó¡£
|
|
.It Bq Er EACCES
|
|
¥Ö¥í¡¼¥É¥¥ã¥¹¥È¤Îµ¡Ç½¤òÄ󶡤·¤Æ¤¤¤Ê¤¤¥½¥±¥Ã¥È¤òÄ̤·¤Æ¡¢
|
|
.Dv ( INADDR_BROADCAST
|
|
Äê¿ô¤Þ¤¿¤Ï
|
|
.Dv INADDR_NONE
|
|
Ìá¤êÃͤòÄ̤·¤Æ³ÍÆÀ¤·¤¿) ¥Ö¥í¡¼¥É¥¥ã¥¹¥È¥¢¥É¥ì¥¹¤ËÀܳ¤·¤è¤¦¤È¤·¤Æ¤¤¤Þ¤¹¡£
|
|
.El
|
|
.Pp
|
|
°Ê¹ß¤Î¥¨¥é¡¼¤Ï¡¢UNIX ¥É¥á¥¤¥ó¤ÎÀܳ̾¤Ë¸ÇͤǤ¹¡£
|
|
¤³¤ì¤é¤Î¥¨¥é¡¼¤Ï¡¢UNIX IPC ¥É¥á¥¤¥ó¤Î¾Íè¤Î
|
|
¥Ð¡¼¥¸¥ç¥ó¤Ë¤ÏŬÍѤµ¤ì¤Ê¤¤²ÄǽÀ¤¬¤¢¤ê¤Þ¤¹¡£
|
|
.Bl -tag -width Er
|
|
.It Bq Er ENOTDIR
|
|
¥Ñ¥¹¤Î¹½À®Í×ÁÇÃæ¤Ë¥Ç¥£¥ì¥¯¥È¥ê°Ê³°¤Î¤â¤Î¤¬´Þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£
|
|
.It Bq Er ENAMETOOLONG
|
|
¥Ñ¥¹Ì¾¤Î¹½À®Í×ÁǤ¬ 255 ʸ»ú¤ò±Û¤¨¤Æ¤¤¤ë¤«¡¢
|
|
¤Þ¤¿¤Ï¥Ñ¥¹Ì¾Á´ÂΤ¬ 1023 ʸ»ú¤ò±Û¤¨¤Æ¤¤¤Þ¤¹¡£
|
|
.It Bq Er ENOENT
|
|
»ØÄê¤Î¥½¥±¥Ã¥È¤¬Â¸ºß¤·¤Þ¤»¤ó¡£
|
|
.It Bq Er EACCES
|
|
»ØÄꤵ¤ì¤¿¥Ñ¥¹¤Ë¤Ï¡¢¸¡º÷¤¬µö²Ä¤µ¤ì¤Æ¤¤¤Ê¤¤¥Ç¥£¥ì¥¯¥È¥ê¤¬´Þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£
|
|
.It Bq Er EACCES
|
|
»ØÄê¤Î¥½¥±¥Ã¥È¤Ø¤Î½ñ¹þ¤ß¥¢¥¯¥»¥¹¤¬µñÀ䤵¤ì¤Æ¤¤¤Þ¤¹¡£
|
|
.It Bq Er ELOOP
|
|
¥Ñ¥¹Ì¾¤òÊÑ´¹¤¹¤ë¤È¤¤Ë¸¡½Ð¤µ¤ì¤¿¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤¬Â¿¤¹¤®¤Þ¤¹¡£
|
|
.El
|
|
.Sh ´ØÏ¢¹àÌÜ
|
|
.Xr accept 2 ,
|
|
.Xr getpeername 2 ,
|
|
.Xr getsockname 2 ,
|
|
.Xr select 2 ,
|
|
.Xr socket 2
|
|
.Sh Îò»Ë
|
|
.Fn connect
|
|
¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï
|
|
.Bx 4.2
|
|
¤ÇÅо줷¤Þ¤·¤¿¡£
|