<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.stream.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ru',
  ),
  'this' => 
  array (
    0 => 'function.stream-socket-accept.php',
    1 => 'stream_socket_accept',
    2 => 'Принимает соединение в сокете, который создали функцией stream_socket_server',
  ),
  'up' => 
  array (
    0 => 'ref.stream.php',
    1 => 'Функции для работы с потоками',
  ),
  'prev' => 
  array (
    0 => 'function.stream-set-write-buffer.php',
    1 => 'stream_set_write_buffer',
  ),
  'next' => 
  array (
    0 => 'function.stream-socket-client.php',
    1 => 'stream_socket_client',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ru',
    'path' => 'reference/stream/functions/stream-socket-accept.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.stream-socket-accept" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">stream_socket_accept</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">stream_socket_accept</span> &mdash; <span class="dc-title">Принимает соединение в сокете, который создали функцией <span class="function"><a href="function.stream-socket-server.php" class="function">stream_socket_server()</a></span></span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.stream-socket-accept-description">
  <h3 class="title">Описание</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>stream_socket_accept</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> <code class="parameter">$socket</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.float.php" class="type float">float</a></span></span> <code class="parameter">$timeout</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter reference">&$peer_name</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><span class="type"><a href="language.types.resource.php" class="type resource">resource</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"><a href="function.stream-socket-server.php" class="function">stream_socket_server()</a></span>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.stream-socket-accept-parameters">
  <h3 class="title">Список параметров</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">socket</code></dt>
     <dd>
      <p class="para">
       Серверный сокет для принятия соединения.
      </p>
     </dd>
    
    
     <dt><code class="parameter">timeout</code></dt>
     <dd>
      <p class="para">
       Переопределяет время ожидания подключения сокета по умолчанию. Время требуется указывать
       в секундах. По умолчанию используется значение директивы <a href="filesystem.configuration.php#ini.default-socket-timeout" class="link">default_socket_timeout</a>.
      </p>
     </dd>
    
    
     <dt><code class="parameter">peer_name</code></dt>
     <dd>
      <p class="para">
       Функция присвоит параметру имя (адрес) клиента, который подключился, если оно
       включено и доступно из выбранного транспорта.
      </p>
      <blockquote class="note"><p><strong class="note">Замечание</strong>: 
       <p class="para">
        Имя можно определить позже функцией
        <span class="function"><a href="function.stream-socket-get-name.php" class="function">stream_socket_get_name()</a></span>.
       </p>
      </p></blockquote>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.stream-socket-accept-returnvalues">
  <h3 class="title">Возвращаемые значения</h3>
  <p class="para">
   Функция возвращает поток принятого соединения с сокетом или <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>, если возникла ошибка.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.stream-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>
       Параметр <code class="parameter">timeout</code> теперь принимает значение null.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 notes" id="refsect1-function.stream-socket-accept-notes">
  <h3 class="title">Примечания</h3>
  <div class="warning"><strong class="warning">Внимание</strong>
   <p class="para">
    Функцию не следует вызывать с серверными UDP-сокетами. Вместо неё вызывают функции
    <span class="function"><a href="function.stream-socket-recvfrom.php" class="function">stream_socket_recvfrom()</a></span>
    и <span class="function"><a href="function.stream-socket-sendto.php" class="function">stream_socket_sendto()</a></span>.
   </p>
 </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.stream-socket-accept-seealso">
  <h3 class="title">Смотрите также</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.stream-socket-server.php" class="function" rel="rdfs-seeAlso">stream_socket_server()</a> - Создаёт серверный сокет Internet- или Unix-домена</span></li>
    <li><span class="function"><a href="function.stream-socket-get-name.php" class="function" rel="rdfs-seeAlso">stream_socket_get_name()</a> - Получает название локального или удалённого сокета</span></li>
    <li><span class="function"><a href="function.stream-set-blocking.php" class="function" rel="rdfs-seeAlso">stream_set_blocking()</a> - Устанавливает блокирующий или неблокирующий режим для потока</span></li>
    <li><span class="function"><a href="function.stream-set-timeout.php" class="function" rel="rdfs-seeAlso">stream_set_timeout()</a> - Устанавливает значение времени ожидания для потока</span></li>
    <li><span class="function"><a href="function.fgets.php" class="function" rel="rdfs-seeAlso">fgets()</a> - Получает строку из указателя на файл</span></li>
    <li><span class="function"><a href="function.fgetss.php" class="function" rel="rdfs-seeAlso">fgetss()</a> - Читает строку из файла и удаляет HTML-теги</span></li>
    <li><span class="function"><a href="function.fwrite.php" class="function" rel="rdfs-seeAlso">fwrite()</a> - Записывает данные в файл в бинарно-безопасном режиме</span></li>
    <li><span class="function"><a href="function.fclose.php" class="function" rel="rdfs-seeAlso">fclose()</a> - Закрывает открытый дескриптор файла</span></li>
    <li><span class="function"><a href="function.feof.php" class="function" rel="rdfs-seeAlso">feof()</a> - Проверяет, достигнут ли конец файла</span></li>
    <li><a href="ref.curl.php" class="xref">Функции cURL</a></li>
   </ul>
  </p>
 </div>


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