listen

LISTEN(2)                  Linux Programmer's Manual                 LISTEN(2)



åå
       listen - ã½ã±ããã®æ¥ç¶ãå¾ã¤

æ¸å¼
       #include <sys/socket.h>

       int listen(int s, int backlog);

説æ
       æ¥ç¶ãè¡ãªãã«ã¯ãæåã« socket(2) ã§ã½ã±ãããä½æãã listen ã§æ¥ç¶ãåãå¥ããæå¿ã¨
       æ¥ç¶ãåãå¥ãããããã¥ã¼ã®å¤§ãããæå®ããããã㦠accept(2) ã§æ¥ç¶ãåãå¥ããã listen
       ã³ã¼ã«ã¯ SOCK_STREAM å㨠SOCK_SEQPACKET åã®ã½ã±ããã®ã¿ã«é©ç¨ã§ããã

       backlog å¼ãæ°ã¯æ¥ç¶è¦æ±ãã¥ã¼ãæé·ã§ããæ大ã®é·ããæå®ããã ããã‐
       ã¥ã¼ãä¸æ¯ã®æã«æ¥ç¶è¦æ±ãæ¥ãå ´åã«ã¯ã¯ã©ã¤ã¢ã³ã㯠ECONNREFUSED
       ã¨ã©ã¼ãåãã¨ãã ããã ã¾ãã¯ãããä¸å±¤ã®ãããã³ã«ãåéä¿¡ããµãã¼ããã¦ããã°ã
       ãã®è¦æ±ã¯å試è¡ã§æåããããã«ç¡è¦ããããããããªãã

è¿ãå¤
       æåããå ´åã¯ã¼ããè¿ããã¨ã©ã¼ã®å ´å㯠-1 ãè¿ãã errno ãé©åã«è¨å®ããã

ã¨ã©ã¼
       EBADF   å¼ãæ° s ãé©åãªãã£ã¹ã¯ãªãã¿ã¼ã§ãªãã

       ENOTSOCK
               å¼ãæ° s ãã½ã±ããã§ãªãã

       EOPNOTSUPP
               ã½ã±ããã listen æä½ããµãã¼ããã¦ããåã§ãªãã

æºæ
       SVr4, 4.4BSD ( listen é¢æ°ã¯ 4.2BSD ã§æåã«ç¾ããã)ã

ãã°
       af_inet åã®ã½ã±ããã§ã backlog
        å¼ãæ°ã« SO_MAXCONN (2.0.23 ã§ã¯ 128) ãã大ããå¤ãæå®ãããå ´åãæé»ã®ãã¡ã«
       SO_MAXCONN ã¾ã§åãæ¨ã¦ã
       ããã移æ¤æ§ãèæ®ããã¢ããªã±ã¼ã·ã§ã³ã§ã¯ãã®å¤ãä¿¡é ¼ãã¦ã¯ãããªãã BSD
       (å°ãªãã¨ãããã¤ãã® BSD ç±æ¥ã®ã·ã¹ãã ã§ã¯) backlog ã 5 ã¾ã§ã« å¶éããã¦ããã

é¢é£é ç®
       accept(2), connect(2), socket(2)



BSD Man Page                     23 July 1993                        LISTEN(2)