<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.sockets.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'function.socket-create-listen.php',
    1 => 'socket_create_listen',
    2 => 'Opens a socket on port to accept connections',
  ),
  'up' => 
  array (
    0 => 'ref.sockets.php',
    1 => 'Socket Функції',
  ),
  'prev' => 
  array (
    0 => 'function.socket-create.php',
    1 => 'socket_create',
  ),
  'next' => 
  array (
    0 => 'function.socket-create-pair.php',
    1 => 'socket_create_pair',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/sockets/functions/socket-create-listen.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<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, PHP 7, PHP 8)</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">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>socket_create_listen</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$port</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$backlog</code><span class="initializer"> = <strong><code><a href="sockets.constants.php#constant.somaxconn">SOMAXCONN</a></code></strong></span></span>): <span class="type"><span class="type"><a href="class.socket.php" class="type Socket">Socket</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>socket_create_listen()</strong></span> creates a new <span class="classname"><a href="class.socket.php" class="classname">Socket</a></span> instance of
   type <strong><code><a href="sockets.constants.php#constant.af-inet">AF_INET</a></code></strong> listening on <em>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">Параметри</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">port</code></dt>
     <dd>
      <p class="para">
       The port on which to listen on all interfaces.
      </p>
     </dd>
    
    
     <dt><code class="parameter">backlog</code></dt>
     <dd>
      <p class="para">
       The <code class="parameter">backlog</code> parameter defines the maximum length
       the queue of pending connections may grow to.
       <strong><code><a href="sockets.constants.php#constant.somaxconn">SOMAXCONN</a></code></strong> may be passed as
       <code class="parameter">backlog</code> parameter, see
       <span class="function"><a href="function.socket-listen.php" class="function">socket_listen()</a></span> for more information.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.socket-create-listen-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   <span class="function"><strong>socket_create_listen()</strong></span> returns a new <span class="classname"><a href="class.socket.php" class="classname">Socket</a></span> instance
   on success or <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> on error. The error code can be retrieved with
   <span class="function"><a href="function.socket-last-error.php" class="function">socket_last_error()</a></span>. This code may be passed to
   <span class="function"><a href="function.socket-strerror.php" class="function">socket_strerror()</a></span> to get a textual explanation of the
   error.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.socket-create-listen-changelog">
  <h3 class="title">Журнал змін</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Версія</th>
      <th>Опис</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.4.0</td>
      <td>
       The default value of is now <strong><code><a href="sockets.constants.php#constant.somaxconn">SOMAXCONN</a></code></strong>.
       Previously it was <code class="literal">128</code>.
      </td>
     </tr>

     <tr>
      <td>8.0.0</td>
      <td>
       On success, this function returns a <span class="classname"><a href="class.socket.php" class="classname">Socket</a></span> instance now;
       previously, a <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> was returned.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 notes" id="refsect1-function.socket-create-listen-notes">
  <h3 class="title">Примітки</h3>
  <blockquote class="note"><p><strong class="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.php" class="function">socket_create()</a></span>,
    <span class="function"><a href="function.socket-bind.php" class="function">socket_bind()</a></span> and <span class="function"><a href="function.socket-listen.php" class="function">socket_listen()</a></span>.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.socket-create-listen-seealso">
  <h3 class="title">Прогляньте також</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.socket-create.php" class="function" rel="rdfs-seeAlso">socket_create()</a> - Create a socket (endpoint for communication)</span></li>
    <li><span class="function"><a href="function.socket-create-pair.php" class="function" rel="rdfs-seeAlso">socket_create_pair()</a> - Creates a pair of indistinguishable sockets and stores them in an array</span></li>
    <li><span class="function"><a href="function.socket-bind.php" class="function" rel="rdfs-seeAlso">socket_bind()</a> - Binds a name to a socket</span></li>
    <li><span class="function"><a href="function.socket-listen.php" class="function" rel="rdfs-seeAlso">socket_listen()</a> - Listens for a connection on a socket</span></li>
    <li><span class="function"><a href="function.socket-last-error.php" class="function" rel="rdfs-seeAlso">socket_last_error()</a> - Returns the last error on the socket</span></li>
    <li><span class="function"><a href="function.socket-strerror.php" class="function" rel="rdfs-seeAlso">socket_strerror()</a> - Return a string describing a socket error</span></li>
   </ul>
  </p>
 </div>

</div><?php manual_footer($setup); ?>