1
0
mirror of https://github.com/php/doc-ru.git synced 2026-03-26 00:32:15 +01:00
Files
archived-doc-ru/reference/stream/functions/stream-socket-accept.xml
2024-06-11 12:41:27 +03:00

143 lines
4.9 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: c3067ab0a7f55632c87da73368fd3c739e110a57 Maintainer: mch Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="function.stream-socket-accept" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>stream_socket_accept</refname>
<refpurpose>Принимает соединение в сокете, который создали функцией <function>stream_socket_server</function></refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type class="union"><type>resource</type><type>false</type></type><methodname>stream_socket_accept</methodname>
<methodparam><type>resource</type><parameter>socket</parameter></methodparam>
<methodparam choice="opt"><type class="union"><type>float</type><type>null</type></type><parameter>timeout</parameter><initializer>&null;</initializer></methodparam>
<methodparam choice="opt"><type>string</type><parameter role="reference">peer_name</parameter><initializer>&null;</initializer></methodparam>
</methodsynopsis>
<para>
Функция принимает соединение в сокете, который предварительно создали функцией
<function>stream_socket_server</function>.
</para>
</refsect1>
<refsect1 role="parameters"><!-- {{{ -->
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>socket</parameter></term>
<listitem>
<para>
Серверный сокет для принятия соединения.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>timeout</parameter></term>
<listitem>
<para>
Переопределяет время ожидания подключения сокета по умолчанию. Время требуется указывать
в секундах. По умолчанию используется значение директивы <link linkend="ini.default-socket-timeout">default_socket_timeout</link>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>peer_name</parameter></term>
<listitem>
<para>
Функция присвоит параметру имя (адрес) клиента, который подключился, если оно
включено и доступно из выбранного транспорта.
</para>
<note>
<para>
Имя можно определить позже функцией
<function>stream_socket_get_name</function>.
</para>
</note>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1><!-- }}} -->
<refsect1 role="returnvalues"><!-- {{{ -->
&reftitle.returnvalues;
<para>
Функция возвращает поток принятого соединения с сокетом&return.falseforfailure;.
</para>
</refsect1><!-- }}} -->
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.0.0</entry>
<entry>
Параметр <parameter>timeout</parameter> теперь принимает значение null.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="notes"><!-- {{{ -->
&reftitle.notes;
<warning>
<para>
Функцию не следует вызывать с серверными UDP-сокетами. Вместо неё вызывают функции
<function>stream_socket_recvfrom</function>
и <function>stream_socket_sendto</function>.
</para>
</warning>
</refsect1><!-- }}} -->
<refsect1 role="seealso"><!-- {{{ -->
&reftitle.seealso;
<para>
<simplelist>
<member><function>stream_socket_server</function></member>
<member><function>stream_socket_get_name</function></member>
<member><function>stream_set_blocking</function></member>
<member><function>stream_set_timeout</function></member>
<member><function>fgets</function></member>
<member><function>fgetss</function></member>
<member><function>fwrite</function></member>
<member><function>fclose</function></member>
<member><function>feof</function></member>
<member><xref linkend="ref.curl"/></member>
</simplelist>
</para>
</refsect1><!-- }}} -->
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->