Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > main > by-pkgid > 0afeee9cca140e167a996902b9a677c5 > files > 2488

php-manual-en-4.3.0-2mdk.noarch.rpm

<HTML
><HEAD
><TITLE
>socket_listen</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="PHP Manual"
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=ISO-8859-1"></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 Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.socket-last-error.html"
ACCESSKEY="P"
>Prev</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"
>Next</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="AEN87653"
></A
><P
>    (PHP 4 &#62;= 4.1.0)</P
>socket_listen&nbsp;--&nbsp;Listens for a connection on a socket</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN87656"
></A
><H2
>Description</H2
>bool <B
CLASS="methodname"
>socket_listen</B
> ( resource socket [, int backlog])<BR
></BR
><DIV
CLASS="warning"
><P
></P
><TABLE
CLASS="warning"
BORDER="1"
WIDTH="100%"
><TR
><TD
ALIGN="CENTER"
><B
>Warning</B
></TD
></TR
><TR
><TD
ALIGN="LEFT"
><P
>This function is
<SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>EXPERIMENTAL</I
></SPAN
>. The behaviour of this function, the
name of this function, and anything else documented about this
function may change without notice in a future release of PHP. 
Use this function at your own risk.</P
></TD
></TR
></TABLE
></DIV
><P
>&#13;     After the socket <TT
CLASS="parameter"
><I
>socket</I
></TT
> 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 <TT
CLASS="parameter"
><I
>socket</I
></TT
>.
    </P
><P
>&#13;     A maximum of <TT
CLASS="parameter"
><I
>backlog</I
></TT
> 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
>Note: </B
>
      The maximum number passed to the <TT
CLASS="parameter"
><I
>backlog</I
></TT
>
      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;     Returns <TT
CLASS="constant"
><B
>TRUE</B
></TT
> on success or <TT
CLASS="constant"
><B
>FALSE</B
></TT
> on failure. 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"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.socket-read.html"
ACCESSKEY="N"
>Next</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"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>socket_read</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>