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

contributors($setup);

?>
<div id="function.socket-accept" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">socket_accept</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.1.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">socket_accept</span> &mdash; <span class="dc-title">Accepts a connection on a socket</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.socket-accept-description">
  <h3 class="title">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>socket_accept</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="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">
   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>, bound to a name with
   <span class="function"><a href="function.socket-bind.php" class="function">socket_bind()</a></span>, and told to listen for connections
   with <span class="function"><a href="function.socket-listen.php" class="function">socket_listen()</a></span>, this function will accept
   incoming connections on that socket. Once a successful connection
   is made, a new <span class="classname"><a href="class.socket.php" class="classname">Socket</a></span> instance is returned,
   which may be used for communication. If there are multiple connections
   queued on the socket, the first will be used. If there are no pending
   connections, <span class="function"><strong>socket_accept()</strong></span> will block until
   a connection becomes present. If <code class="parameter">socket</code>
   has been made non-blocking using
   <span class="function"><a href="function.socket-set-blocking.php" class="function">socket_set_blocking()</a></span> or
   <span class="function"><a href="function.socket-set-nonblock.php" class="function">socket_set_nonblock()</a></span>, <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> will be returned.
  </p>
  <p class="para">
   The <span class="classname"><a href="class.socket.php" class="classname">Socket</a></span> instance returned by
   <span class="function"><strong>socket_accept()</strong></span> may not be used to accept new
   connections. The original listening socket
   <code class="parameter">socket</code>, however, remains open and may be
   reused.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.socket-accept-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>.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.socket-accept-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   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 actual
   error code can be retrieved by calling
   <span class="function"><a href="function.socket-last-error.php" class="function">socket_last_error()</a></span>. This error 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-accept-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>
       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 seealso" id="refsect1-function.socket-accept-seealso">
  <h3 class="title">Прогляньте також</h3>
  <p class="para">
   <ul class="simplelist">
    <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-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-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-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-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); ?>