mirror of
https://github.com/php/doc-ja.git
synced 2026-03-24 07:02:08 +01:00
152 lines
4.9 KiB
XML
152 lines
4.9 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 14dc7c47365f2b71f6c907a5ba5bccf42534d5a9 Maintainer: hirokawa Status: ready -->
|
|
<!-- CREDITS: takagi -->
|
|
<refentry xml:id="function.socket-read" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>socket_read</refname>
|
|
<refpurpose>ソケットから最大バイト長まで読みこむ</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type class="union"><type>string</type><type>false</type></type><methodname>socket_read</methodname>
|
|
<methodparam><type>Socket</type><parameter>socket</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>length</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>mode</parameter><initializer><constant>PHP_BINARY_READ</constant></initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
関数 <function>socket_read</function> は、関数
|
|
<function>socket_create</function> または
|
|
<function>socket_accept</function> により作成された
|
|
<classname>Socket</classname> クラスのインスタンス
|
|
<parameter>socket</parameter> から読み込みます。
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>socket</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
<function>socket_create</function> あるいは <function>socket_accept</function>
|
|
で作成した <classname>Socket</classname> クラスのインスタンス。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>length</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
読み込まれる最大バイト長は、<parameter>length</parameter> パラメータで
|
|
指定します。
|
|
読み込みを終了するために
|
|
<constant>\r</constant>、<constant>\n</constant>、
|
|
<constant>\0</constant> を使用することが可能です
|
|
(これは、以下に示す <parameter>mode</parameter> に依存します)。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>mode</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
オプションのパラメータ <parameter>mode</parameter> は、名前のある定数です。
|
|
<itemizedlist>
|
|
<listitem>
|
|
<simpara>
|
|
<constant>PHP_BINARY_READ</constant> (デフォルト) -
|
|
システムの <literal>recv()</literal> 関数を
|
|
使用します。バイナリデータ読み込みに関して安全です。
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
<constant>PHP_NORMAL_READ</constant> -
|
|
読み込みは、<literal>\n</literal> あるいは <literal>\r</literal> で中断されます。
|
|
</simpara>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
<function>socket_read</function> は、成功時に文字列としてデータを返し、
|
|
エラー時 (リモートホストが接続をクローズした場合を含みます)
|
|
に &false; を返します。
|
|
エラーコードは <function>socket_last_error</function> で取得可能であり、
|
|
このコードは、エラー文字列を取得するために
|
|
<function>socket_strerror</function> に渡すことができます。
|
|
</para>
|
|
<note>
|
|
<para>
|
|
<function>socket_read</function> は、読み込むデータがもう存在しない
|
|
場合に長さゼロの文字列("")を返します。
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
&sockets.changelog.socket-param;
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>socket_accept</function></member>
|
|
<member><function>socket_bind</function></member>
|
|
<member><function>socket_connect</function></member>
|
|
<member><function>socket_listen</function></member>
|
|
<member><function>socket_last_error</function></member>
|
|
<member><function>socket_strerror</function></member>
|
|
<member><function>socket_write</function></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
|
|
-->
|