<?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-listen.php',
    1 => 'socket_listen',
    2 => 'Listens for a connection on a socket',
  ),
  'up' => 
  array (
    0 => 'ref.sockets.php',
    1 => 'Socket Функції',
  ),
  'prev' => 
  array (
    0 => 'function.socket-last-error.php',
    1 => 'socket_last_error',
  ),
  'next' => 
  array (
    0 => 'function.socket-read.php',
    1 => 'socket_read',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/sockets/functions/socket-listen.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.socket-listen" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">socket_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_listen</span> &mdash; <span class="dc-title">Listens for a connection on a socket</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.socket-listen-description">
  <h3 class="title">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>socket_listen</strong></span>(<span class="methodparam"><span class="type"><a href="class.socket.php" class="type Socket">Socket</a></span> <code class="parameter">$socket</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"> = 0</span></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   After the socket <code class="parameter">socket</code> has been created
   using <span class="function"><a href="function.socket-create.php" class="function">socket_create()</a></span> and bound to a name with
   <span class="function"><a href="function.socket-bind.php" class="function">socket_bind()</a></span>, it may be told to listen for incoming
   connections on <code class="parameter">socket</code>.
  </p>
  <p class="para">
   <span class="function"><strong>socket_listen()</strong></span> is applicable only to sockets of
   type <strong><code><a href="sockets.constants.php#constant.sock-stream">SOCK_STREAM</a></code></strong> or
   <strong><code><a href="sockets.constants.php#constant.sock-seqpacket">SOCK_SEQPACKET</a></code></strong>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.socket-listen-parameters">
  <h3 class="title">Параметри</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">socket</code></dt>
     <dd>
      <p class="para">
       A <span class="classname"><a href="class.socket.php" class="classname">Socket</a></span> instance created with <span class="function"><a href="function.socket-create.php" class="function">socket_create()</a></span>
       or <span class="function"><a href="function.socket-addrinfo-bind.php" class="function">socket_addrinfo_bind()</a></span>
      </p>
     </dd>
    
    
     <dt><code class="parameter">backlog</code></dt>
     <dd>
      <p class="para">
       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
       <code class="literal">ECONNREFUSED</code>, or, if the underlying protocol supports
       retransmission, the request may be ignored so that retries may succeed.
      </p>
      <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
       <p class="para">
        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 <strong><code><a href="sockets.constants.php#constant.somaxconn">SOMAXCONN</a></code></strong>. On win32, if
        passed <strong><code><a href="sockets.constants.php#constant.somaxconn">SOMAXCONN</a></code></strong>, the underlying service provider
        responsible for the socket will set the backlog to a maximum
        <em>reasonable</em> value. There is no standard provision to
        find out the actual backlog value on this platform.
       </p>
      </p></blockquote>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.socket-listen-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   Повертає <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> у разі успіху або <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> в разі помилки. 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-listen-changelog">
  <h3 class="title">Журнал змін</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Версія</th>
      <th>Опис</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
  <td>8.0.0</td>
  <td>
   Тепер <code class="parameter">socket</code> є примірником
   <span class="classname"><a href="class.socket.php" class="classname">Socket</a></span>; раніше це був <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span>.
  </td>
 </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 seealso" id="refsect1-function.socket-listen-seealso">
  <h3 class="title">Прогляньте також</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.socket-accept.php" class="function" rel="rdfs-seeAlso">socket_accept()</a> - Accepts a connection on a socket</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-connect.php" class="function" rel="rdfs-seeAlso">socket_connect()</a> - Initiates a connection on a socket</span></li>
    <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-strerror.php" class="function" rel="rdfs-seeAlso">socket_strerror()</a> - Return a string describing a socket error</span></li>
    <li><span class="function"><a href="function.socket-addrinfo-bind.php" class="function" rel="rdfs-seeAlso">socket_addrinfo_bind()</a> - Create and bind to a socket from a given addrinfo</span></li>
   </ul>
  </p>
 </div>


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