Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > 05cd670d8a02b2b4a0ffb1756f2e8308 > files > 4374

php-manual-zh-5.2.4-1mdv2008.1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>socket_listen</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="PHP 手册"
HREF="index.html"><LINK
REL="UP"
TITLE="Socket Functions"
HREF="ref.sockets.html"><LINK
REL="PREVIOUS"
TITLE="socket_last_error"
HREF="function.socket-last-error.html"><LINK
REL="NEXT"
TITLE="socket_read"
HREF="function.socket-read.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=UTF-8"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP 手册</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.socket-last-error.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.socket-read.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.socket-listen"
></A
>socket_listen</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN213352"
></A
><P
>    (PHP 4 &#62;= 4.1.0, PHP 5)</P
>socket_listen&nbsp;--&nbsp;Listens for a connection on a socket</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN213355"
></A
><H2
>Description</H2
>bool <B
CLASS="methodname"
>socket_listen</B
> ( resource socket [, int backlog] )<BR
></BR
><P
>&#13;     After the socket <CODE
CLASS="parameter"
>socket</CODE
> has been created
     using <A
HREF="function.socket-create.html"
><B
CLASS="function"
>socket_create()</B
></A
> and bound to a name with
     <A
HREF="function.socket-bind.html"
><B
CLASS="function"
>socket_bind()</B
></A
>, it may be told to listen for incoming
     connections on <CODE
CLASS="parameter"
>socket</CODE
>.
    </P
><P
>&#13;     A maximum of <CODE
CLASS="parameter"
>backlog</CODE
> incoming connections will be
     queued for processing. If a connection request arrives with the queue
     full the client may receive an error with an indication of
     <TT
CLASS="literal"
>ECONNREFUSED</TT
>, or, if the underlying protocol supports
     retransmission, the request may be ignored so that retries may succeed.
    </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>注意: </B
>
      The maximum number passed to the <CODE
CLASS="parameter"
>backlog</CODE
>
      parameter highly depends on the underlying platform. On Linux, it is
      silently truncated to <TT
CLASS="constant"
><B
>SOMAXCONN</B
></TT
>. On win32, if
      passed <TT
CLASS="constant"
><B
>SOMAXCONN</B
></TT
>, the underlying service provider
      responsible for the socket will set the backlog to a maximum
      <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>reasonable</I
></SPAN
> value. There is no standard provision to
      find out the actual backlog value on this platform.
     </P
></BLOCKQUOTE
></DIV
><P
>&#13;     <B
CLASS="function"
>socket_listen()</B
> is applicable only to sockets of
     type <TT
CLASS="constant"
><B
>SOCK_STREAM</B
></TT
> or
     <TT
CLASS="constant"
><B
>SOCK_SEQPACKET</B
></TT
>.
    </P
><P
>&#13;     如果成功则返回 <TT
CLASS="constant"
><B
>TRUE</B
></TT
>,失败则返回 <TT
CLASS="constant"
><B
>FALSE</B
></TT
>。 The error code can be retrieved with
     <A
HREF="function.socket-last-error.html"
><B
CLASS="function"
>socket_last_error()</B
></A
>. This code may be passed to
     <A
HREF="function.socket-strerror.html"
><B
CLASS="function"
>socket_strerror()</B
></A
> to get a textual explanation of the
     error.
    </P
><P
>&#13;     See also
     <A
HREF="function.socket-accept.html"
><B
CLASS="function"
>socket_accept()</B
></A
>,
     <A
HREF="function.socket-bind.html"
><B
CLASS="function"
>socket_bind()</B
></A
>,
     <A
HREF="function.socket-connect.html"
><B
CLASS="function"
>socket_connect()</B
></A
>,
     <A
HREF="function.socket-create.html"
><B
CLASS="function"
>socket_create()</B
></A
> and
     <A
HREF="function.socket-strerror.html"
><B
CLASS="function"
>socket_strerror()</B
></A
>.
    </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.socket-last-error.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>起始页</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.socket-read.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>socket_last_error</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.sockets.html"
ACCESSKEY="U"
>上一级</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>socket_read</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>