1 .\" Copyright (c) 1983, 1991 The Regents of the University of California.
2 .\" and Copyright (C) 2007, Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
13 .\" 3. All advertising materials mentioning features or use of this software
14 .\" must display the following acknowledgement:
15 .\" This product includes software developed by the University of
16 .\" California, Berkeley and its contributors.
17 .\" 4. Neither the name of the University nor the names of its contributors
18 .\" may be used to endorse or promote products derived from this software
19 .\" without specific prior written permission.
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .\" $Id: listen.2,v 1.4 2001/05/19 02:09:20 hanataka Exp $
35 .\" Modified Fri Jul 23 22:07:54 1993 by Rik Faith <faith@cs.unc.edu>
36 .\" Modified 950727 by aeb, following a suggestion by Urs Thuermann
37 .\" <urs@isnogud.escape.de>
38 .\" Modified Tue Oct 22 08:11:14 EDT 1996 by Eric S. Raymond <esr@thyrsus.com>
39 .\" Modified 1998 by Andi Kleen
40 .\" Modified 11 May 2001 by Sam Varshavchik <mrsam@courier-mta.com>
42 .\" Japanese Version Copyright (c) 1998 Shinya HANATAKA, Takeshi Hakamada
43 .\" all rights reserved.
44 .\" Translated 1998-04-06,Shinya HANATAKA <shinya@abyss.rim.or.jp>
45 .\" and Takeshi Hakamada <hakamada@nsg.sgi.com>
46 .\" Modified 2000-01-13, Kentaro Shirakata <argrath@yo.rim.or.jp>
47 .\" Modified 2001-05-19, Shinya HANATAKA <shinya@abyss.rim.or.jp>
48 .\" Updated 2007-07-04, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.58
49 .\" Updated 2008-02-10, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.77
51 .\"WORD: socket ¥½¥±¥Ã¥È
54 .\"WORD: descriptor ¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼
56 .TH LISTEN 2 2008-11-20 "Linux" "Linux Programmer's Manual"
58 listen \- ¥½¥±¥Ã¥È(socket)¾å¤ÎÀܳ¤òÂÔ¤Ä
61 .BR "#include <sys/types.h>" " /* ¡ÖÃí°Õ¡×»²¾È */"
63 .B #include <sys/socket.h>
65 .BI "int listen(int " sockfd ", int " backlog );
71 ¤¬»²¾È¤¹¤ë¥½¥±¥Ã¥È¤òÀܳÂÔ¤Á¥½¥±¥Ã¥È (passive socket) ¤È¤·¤Æ°õ¤ò¤Ä¤±¤ë¡£
72 ÀܳÂÔ¤Á¥½¥±¥Ã¥È¤È¤Ï¡¢
74 ¤ò»È¤Ã¤ÆÅþÃ夷¤¿ÀܳÍ×µá¤ò¼õ¤±ÉÕ¤±¤ë¤Î¤Ë»ÈÍѤµ¤ì¤ë¥½¥±¥Ã¥È¤Ç¤¢¤ë¡£
81 ·¿¤Î¥½¥±¥Ã¥È¤ò»²¾È¤¹¤ë¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ç¤¢¤ë¡£
86 ¤Ë¤Ä¤¤¤Æ¤ÎÊÝαÃæ¤ÎÀܳ¤Î¥¥å¡¼¤ÎºÇÂçŤò»ØÄꤹ¤ë¡£
87 ¥¥å¡¼¤¬¤¤¤Ã¤Ñ¤¤¤Î¾õÂÖ¤ÇÀܳÍ׵᤬ÅþÃ夹¤ë¤È¡¢¥¯¥é¥¤¥¢¥ó¥È¤Ï
89 ¤È¤¤¤¦¥¨¥é¡¼¤ò¼õ¤±¼è¤ë¡£²¼°ÌÁؤΥץí¥È¥³¥ë¤¬ºÆÁ÷¿®¤ò¥µ¥Ý¡¼¥È
90 ¤·¤Æ¤¤¤ì¤Ð¡¢Í×µá¤Ï̵»ë¤µ¤ì¡¢¤³¤ì°Ê¹ß¤ÎÀܳÍ×µá¤ÎºÆÁ÷¿®¤¬À®¸ù¤¹¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
92 À®¸ù»þ¤Ë¤Ï0¤òÊÖ¤¹¡£¥¨¥é¡¼»þ¤Ë¤Ï \-1¤òÊÖ¤·¡¢
98 Ê̤Υ½¥±¥Ã¥È¤¬´û¤ËƱ¤¸¥Ý¡¼¥È¤ò listen ¤·¤Æ¤¤¤ë¡£
103 ¤Ï͸ú¤Ê¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼¤Ç¤Ï¤Ê¤¤¡£
113 ¤¬¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë·¿¤Ç¤Ï¤Ê¤¤¡£
115 4.4BSD, POSIX.1-2001.
117 ´Ø¿ô¤Ï 4.2BSD¤Ç½é¤á¤Æ¼ÂÁõ¤µ¤ì¤¿¡£
119 Àܳ¤ò¼õ¤±ÉÕ¤±¤ë¤Ë¤Ï¡¢°Ê²¼¤Î½èÍý¤¬¼Â¹Ô¤µ¤ì¤ë¡£
123 ¤Ç¥½¥±¥Ã¥È¤òºîÀ®¤¹¤ë¡£
126 ¤ò»È¤Ã¤Æ¥½¥±¥Ã¥È¤Ë¥í¡¼¥«¥ë¥¢¥É¥ì¥¹¤ò³ä¤êÅö¤Æ¤Æ¡¢
127 ¾¤Î¥½¥±¥Ã¥È¤¬¤³¤Î¥½¥±¥Ã¥È¤Ë
132 ¤ò»È¤Ã¤Æ¡¢ÀܳÍ×µá¤ò¼õ¤±ÉÕ¤±¤ë°Õ»Ö¤ÈÀܳÍ×µá¤òÆþ¤ì¤ë¥¥å¡¼Ä¹¤ò»ØÄꤹ¤ë¡£
135 ¤ò»È¤Ã¤ÆÀܳ¤ò¼õ¤±ÉÕ¤±¤ë¡£
140 ¤Î¥¤¥ó¥¯¥ë¡¼¥É¤Ïɬ¿Ü¤È¤µ¤ì¤Æ¤ª¤é¤º¡¢
141 Linux ¤Ç¤Ï¤³¤Î¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤ÏɬÍפǤϤʤ¤¡£
142 ¤·¤«¤·¡¢Îò»ËŪ¤Ë¤Ï¡¢¤¤¤¯¤Ä¤«¤Î¼ÂÁõ (BSD ·Ï) ¤Ç¤³¤Î¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤¬
143 ɬÍפǤ¢¤ê¡¢°Ü¿¢À¤¬É¬Íפʥ¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ç¤Ï¤³¤Î¥Õ¥¡¥¤¥ë¤ò
144 ¥¤¥ó¥¯¥ë¡¼¥É¤¹¤ë¤Î¤¬¸ÌÀ¤Ç¤¢¤í¤¦¡£
148 °ú¤¿ô¤Î¿¶¤ëÉñ¤¤¤Ï Linux 2.2 ¤ÇÊѹ¹¤µ¤ì¤¿¡£
149 ¸½ºß¤Ç¤Ï¤³¤Î°ú¤¿ô¤Ï¡¢
150 ¼õ¤±ÉÕ¤±¤é¤ì¤ë¤Î¤òÂԤäƤ¤¤ë¡¢
152 ³ÎΩ¤µ¤ì¤¿¥½¥±¥Ã¥È¤Î¥¥å¡¼¤ÎŤµ¤ò»ØÄꤹ¤ë¡£
153 °ÊÁ°¤ÏÉÔ´°Á´¤ÊÀܳÍ×µá¤Î¿ô¤Ç¤¢¤Ã¤¿¤¬¡¢¤³¤ì¤òÃÖ¤´¹¤¨¤¿¡£
154 ÉÔ´°Á´¤Ê¥½¥±¥Ã¥È¤Î¥¥å¡¼¤ÎºÇÂçŤÏ
155 .I /proc/sys/net/ipv4/tcp_max_syn_backlog
157 syncookie ¤¬Í¸ú¤Ë¤Ê¤Ã¤Æ¤¤¤ë¾ì¹ç¡¢
158 ÏÀÍýŪ¤ÊºÇÂçĹ¤Ï¸ºß¤»¤º¡¢¤³¤ÎÀßÄê¤Ï̵»ë¤µ¤ì¤ë¡£
162 .I /proc/sys/net/core/somaxconn
163 ¤ÎÃͤè¤ê¤âÂ礤±¤ì¤Ð¡¢
165 ¤ÎÃͤϰÅÌۤΤ¦¤Á¤Ë¤³¤ÎÃͤËÀÚ¤êµÍ¤á¤é¤ì¤ë¡£
166 ¤³¤Î¥Õ¥¡¥¤¥ë¤Î¥Ç¥Õ¥©¥ë¥ÈÃÍ¤Ï 128 ¤Ç¤¢¤ë¡£
167 ¥Ð¡¼¥¸¥ç¥ó 2.4.5 °ÊÁ°¤Î¥«¡¼¥Í¥ë¤Ç¤Ï¡¢¤³¤Î¾å¸ÂÃͤÏ
168 ¥³¡¼¥ÉËä¤á¹þ¤ß¤Î¸ÇÄêÃÍ
170 ¤Ç¤¢¤ê¡¢¤½¤ÎÃÍ¤Ï 128 ¤Ç¤¢¤Ã¤¿¡£
171 .\" °Ê²¼¤Ï¡¢º£¤Ç¤Ï¸Å¤¤¾ðÊó¤Ç¤¢¤ë¡£(MTK, Jun 05)
172 .\" BSD (¤È¡¢¤¤¤¯¤Ä¤«¤Î BSD ¤«¤éÇÉÀ¸¤·¤¿¥·¥¹¥Æ¥à)¤Ç¤Ï backlog ¤ò 5 ¤Ë
173 .\" À©¸Â¤·¤Æ¤¤¤ë¤Î¤Ç¡¢°Ü¿¢À¤ò¹Íθ¤·¤¿¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ç¤Ï
174 .\" ¤³¤ÎÃÍ (SOMAXCONN) ¤ËÍê¤Ã¤Æ¤Ï¤¤¤±¤Ê¤¤¡£