.\" 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. .\" .\" @(#) bind. 2 8.1 (Berkeley) 6/4/93 .\" %FreeBSD: src/lib/libc/sys/bind. 2, v 1.11. 2.9 2002/07/08 13:07:42 dannyboy Exp % .\" .\" $FreeBSD: doc/ja_JP.eucJP/man/man2/bind. 2, v 1.11 2002/07/21 22:30:43 horikawa Exp $ .Dd June 4, 1993 .Dt BIND 2 .Os .Sh ¸íĪ .Nm bind .Nd assign a local protocol address to a socket .Sh ÇÁ·Î±×·¥ ¶óÀ̺귯¸® .Lb libc .Sh ¼­½Ä .In sys/types.h .In sys/socket.h .Ft int .Fn bind "int s" "const struct sockaddr *addr" "socklen_t addrlen" .Sh ÇØ¼³ .Fn bind (Àº)´Â, ·ÎÄà ÇÁ·ÎÅäÄÝ ÁÖ¼Ò¸¦ ¼ÒÄÏ¿¡ ÇÒ´çÇÕ´Ï´Ù. ¼ÒÄÏÀº, .Xr socket 2 ±×¸®°í ÀÛ¼ºµÉ ¶§¿¡ ÁÖ¼Ò ÆÐ¹Ð¸® °ø°£¿¡ Á¸ÀçÇÕ´Ï´Ù¸¸, ÇÁ·ÎÅäÄÝ ÁÖ¼Ò´Â ÇÒ´çÇÒ ¼ö ÀÖ°í ÀÖÁö ¾Ê½À´Ï´Ù. .Fn bind (Àº)´Â ¼ÒÄÏ¿¡ .Fa addr (À»)¸¦ ÇÒ´çÇÏ´Â °ÍÀ» ¿ä±¸ÇÕ´Ï´Ù. .Sh ÁÖ UNIX µµ¸ÞÀγ»¿¡¼­ÀÇ ÁÖ¼ÒÀÇ ¹ÙÀε忡 ÀÇÇØ ÆÄÀÏ ½Ã½ºÅÛ³»¿¡ ¼ÒÄÏÀÌ ÀÛ¼ºµË´Ï´Ù. À̰ÍÀº, ÇÊ¿ä¾ø°Ô µÇ¾úÀ» ¶§¿¡ È£ÃâÃøÀÌ .Pf ( Xr unlink 2 (À»)¸¦ »ç¿ëÇØ) »èÁ¦ÇÒ Çʿ䰡 ÀÖ½À´Ï´Ù. .Pp ÁÖ¼ÒÀÇ ¹ÙÀεå·Î »ç¿ëµÇ´Â ±ÔÄ¢Àº Åë½Å µµ¸ÞÀΰ£¿¡ ´Ù¸¨´Ï´Ù. »ó¼¼ÇÑ °Í¿¡ ´ëÇÏ¿©´Â, ¼½¼Ç 4 ÀÇ ¸Þ´º¾ó ¿£Æ®¸®¸¦ ÂüÁ¶ÇØ ÁÖ¼¼¿ä. .Pp À̽ļºÀ» ÃÖ´ë·Î Çϱâ À§Çؼ­(¶§¹®¿¡)´Â, ¼ÒÄÏ ±¸Á¶Ã¼´Â, »ç¿ëÀü Áï À̰ÍÀ» .Fn bind ¿¡ °Ç³×ÁÖ±â Àü¿¡, 0 À¸·Î ¹¯¾î¾ß ÇÕ´Ï´Ù. .Sh ¹Ýȯ°ª .Rv -std bind .Sh ¿¡·¯ .Fn bind È£ÃâÀº ´ÙÀ½ÀÇ °æ¿ì¿¡ ½ÇÆÐÇÕ´Ï´Ù. .Bl -tag -width Er .It Bq Er EAGAIN ¿ä±¸¸¦ ä¿ì±â À§ÇÑ Ä¿³Î ¸®¼Ò½º¸¦ ÀϽÃÀûÀ¸·Î ÀÌ¿ëÇÒ ¼ö ¾ø½À´Ï´Ù. .It Bq Er EBADF .Fa s ÇÏÁö¸¸ À¯È¿ÇÑ ±â¼úÀÚ°¡ ¾Æ´Õ´Ï´Ù. .It Bq Er ENOTSOCK .Fa s ÇÏÁö¸¸ ¼ÒÄÏÀÌ ¾Æ´Õ´Ï´Ù. .It Bq Er EADDRNOTAVAIL ÁöÁ¤ÀÇ ÁÖ¼Ò°¡ ·ÎÄà ¸Ó½ÅÀ¸·ÎºÎÅÍ ÀÌ¿ëÇÒ ¼ö ¾ø½À´Ï´Ù. .It Bq Er EADDRINUSE ÁöÁ¤ÀÇ ÁÖ¼Ò´Â ÀÌ¹Ì »ç¿ëÁßÀÔ´Ï´Ù. .It Bq Er EACCES ¿ä±¸µÈ ÁÖ¼Ò´Â º¸È£µÇ°í ÀÖ¾î ÇöÀçÀÇ À¯Àú°¡ °¡Áö°í ÀÖ´Â ÆÛ¹Ì¼ÇÀº °Å±â¿¡ ¾×¼¼½º Çϴµ¥´Â ºÎÀûÀýÇÕ´Ï´Ù. .It Bq Er EFAULT .Fa addr ÆÄ¶ó¹ÌÅͰ¡ À¯È¿ÇÑ À¯Àú address °ø°£ÀÌ ¾Æ´Õ´Ï´Ù. .El .Pp ´ÙÀ½ÀÇ ¿¡·¯´Â UNIX µµ¸ÞÀγ»ÀÇ ¹ÙÀÎµå¾Æµå·¹½º¿¡ °íÀ¯ÀÇ °ÍÀÔ´Ï´Ù. .Bl -tag -width EADDRNOTAVA .It Bq Er ENOTDIR ÆÐ½ºÀÇ ¿ø°¡¿ä¼ÒÁß¿¡ µð·ºÅ丮 ÀÌ¿ÜÀÇ °ÍÀÌ Æ÷ÇԵǾî ÀÖ½À´Ï´Ù. .It Bq Er ENAMETOOLONG ÆÐ½º¸íÀÇ ¿ø°¡¿ä¼Ò°¡ 255 ij¸¯Å͸¦ ³Ñ°í ÀÖ´ÂÁö, ¶Ç´Â ÆÐ½º¸í Àüü°¡ 1023 ij¸¯Å͸¦ ³Ñ°í ÀÖ½À´Ï´Ù. .It Bq Er ENOENT ÆÐ½º¸íÀÇ Á¢µÎ»ç ¿ø°¡¿ä¼Ò°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù. .It Bq Er ELOOP ÆÐ½º¸íÀ» º¯È¯ÇÒ °æ¿ì¿¡ °ËÃâµÈ ±âÈ£ ¿¬°áÀÌ ³Ê¹« ¸¹½À´Ï´Ù. .It Bq Er EIO µð·ºÅ丮 ¿£Æ®¸®¸¦ ÀÛ¼ºÇÑ µ¿¾È, ¶Ç´Â inode ¸¦ ÇÒ´çÇØ Çϰí ÀÖ´Â µ¿¾È¿¡ ÀÔÃâ·Â ¿¡·¯°¡ ¹ß»ýÇß½À´Ï´Ù. .It Bq Er EROFS ÁöÁ¤µÈ ÆÄÀÏÀº Àбâ Àü¿ë ÆÄÀÏ ½Ã½ºÅÛ»ó¿¡ ÀÖ½À´Ï´Ù. .It Bq Er EISDIR ÇÏ´ÃÀÇ ÆÐ½º¸íÀÌ ÁöÁ¤µÇ¾ú½À´Ï´Ù. .El .Sh °ü·Ã Ç׸ñ .Xr connect 2 , .Xr getsockname 2 , .Xr listen 2 , .Xr socket 2 .Sh ¿ª»ç .Fn bind ÇÔ¼ö´Â .Bx 4.2 ±×¸®°í µîÀåÇß½À´Ï´Ù.