Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 5807

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Opens a socket on port to accept connections</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.socket-connect.html">socket_connect</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.socket-create-pair.html">socket_create_pair</a></div>
 <div class="up"><a href="ref.sockets.html">Socket Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.socket-create-listen" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">socket_create_listen</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.1.0, PHP 5)</p><p class="refpurpose"><span class="refname">socket_create_listen</span> &mdash; <span class="dc-title">Opens a socket on port to accept connections </span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.socket-create-listen-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">resource</span> <span class="methodname"><strong>socket_create_listen</strong></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$port</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$backlog</code><span class="initializer"> = 128</span></span>
  ] )</div>

  <p class="para rdfs-comment">
    <span class="function"><strong>socket_create_listen()</strong></span> creates a new socket resource of
   type <strong><code>AF_INET</code></strong> listening on <em class="emphasis">all</em>
   local interfaces on the given port waiting for new connections.
  </p>
  <p class="para">
   This function is meant to ease the task of creating a new socket which
   only listens to accept new connections.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.socket-create-listen-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">port</code></em></span>
     <dd>

      <p class="para">
       The port on which to listen on all interfaces.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">backlog</code></em></span>
     <dd>

      <p class="para">
       The <em><code class="parameter">backlog</code></em> parameter defines the maximum length
       the queue of pending connections may grow to.
       <strong><code>SOMAXCONN</code></strong> may be passed as
       <em><code class="parameter">backlog</code></em> parameter, see
        <span class="function"><a href="function.socket-listen.html" class="function">socket_listen()</a></span> for more information.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.socket-create-listen-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
    <span class="function"><strong>socket_create_listen()</strong></span> returns a new socket resource
   on success or <strong><code>FALSE</code></strong> on error. The error code can be retrieved with
    <span class="function"><a href="function.socket-last-error.html" class="function">socket_last_error()</a></span>. This code may be passed to
    <span class="function"><a href="function.socket-strerror.html" class="function">socket_strerror()</a></span> to get a textual explanation of the
   error.
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.socket-create-listen-notes">
  <h3 class="title">Notes</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    If you want to create a socket which only listens on a certain
    interface you need to use  <span class="function"><a href="function.socket-create.html" class="function">socket_create()</a></span>,
     <span class="function"><a href="function.socket-bind.html" class="function">socket_bind()</a></span> and  <span class="function"><a href="function.socket-listen.html" class="function">socket_listen()</a></span>.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.socket-create-listen-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="function"><a href="function.socket-create.html" class="function" rel="rdfs-seeAlso">socket_create()</a> - Create a socket (endpoint for communication)</span></li>
    <li class="member"> <span class="function"><a href="function.socket-create-pair.html" class="function" rel="rdfs-seeAlso">socket_create_pair()</a> - Creates a pair of indistinguishable sockets and stores them in an array</span></li>
    <li class="member"> <span class="function"><a href="function.socket-bind.html" class="function" rel="rdfs-seeAlso">socket_bind()</a> - Binds a name to a socket</span></li>
    <li class="member"> <span class="function"><a href="function.socket-listen.html" class="function" rel="rdfs-seeAlso">socket_listen()</a> - Listens for a connection on a socket</span></li>
    <li class="member"> <span class="function"><a href="function.socket-last-error.html" class="function" rel="rdfs-seeAlso">socket_last_error()</a> - Returns the last error on the socket</span></li>
    <li class="member"> <span class="function"><a href="function.socket-strerror.html" class="function" rel="rdfs-seeAlso">socket_strerror()</a> - Return a string describing a socket error</span></li>
   </ul>
  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.socket-connect.html">socket_connect</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.socket-create-pair.html">socket_create_pair</a></div>
 <div class="up"><a href="ref.sockets.html">Socket Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>