mfischer Wed May 1 12:33:46 2002 EDT Modified files: /phpdoc/en/reference/sockets/functions socket-read.xml Log: - Update docs. Index: phpdoc/en/reference/sockets/functions/socket-read.xml diff -u phpdoc/en/reference/sockets/functions/socket-read.xml:1.2 phpdoc/en/reference/sockets/functions/socket-read.xml:1.3 --- phpdoc/en/reference/sockets/functions/socket-read.xml:1.2 Wed Apr 17 02:44:09 2002 +++ phpdoc/en/reference/sockets/functions/socket-read.xml Wed May 1 12:33:46 +2002 @@ -1,35 +1,49 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- splitted from ./en/functions/sockets.xml, last change in rev 1.8 --> <refentry id="function.socket-read"> <refnamediv> <refname>socket_read</refname> - <refpurpose>Reads from a socket</refpurpose> + <refpurpose>Reads a maximum of length bytes from socket</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>string</type><methodname>socket_read</methodname> - <methodparam><type>resource</type><parameter>socket_des</parameter></methodparam> + <methodparam><type>resource</type><parameter>socket</parameter></methodparam> <methodparam><type>int</type><parameter>length</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>type</parameter></methodparam> </methodsynopsis> - &warn.experimental.func; + &warn.experimental.func; <para> - The function <function>socket_read</function> reads from socket - <parameter>socket_des</parameter> created by the - <function>socket_accept</function> function the number of bytes set by - <parameter>length</parameter>. Otherwise you can use \n, \t or \0 to - end reading. Returns data, or FALSE if - <function>socket_read</function> failed. + The function <function>socket_read</function> reads from socket + <parameter>socket</parameter> created by the + <function>socket_accept</function> function the maximum number of bytes set by + <parameter>length</parameter>. Otherwise you can use \r, \n or \0 to + end reading (depending on the <parameter>type</parameter> parameter, see + below). </para> <para> + Returns the data as string on success, &false; on error. The error code + can be retrieved with <function>socket_last_error</function>. This code + may be passed to <function>socket_strerror</function> to get a textual + explanation of the error. + </para> + <note> + <para> + <function>socket_read</function> may return a zero length string + indicating the end of communication (i.e. the remote end point has + closed the connection). + </para> + </note> + <para> Optional <parameter>type</parameter> parameter is a named constant: <itemizedlist> <listitem> <simpara> - PHP_BINARY_READ - use the system <function>socket_read</function> - (Default in PHP >= 4.1.0) + PHP_BINARY_READ - use the system <literal>read()</literal> function. + Safe for reading binary data. (Default in PHP + >= 4.1.0) </simpara> </listitem> <listitem> @@ -40,13 +54,14 @@ </itemizedlist> </para> <para> - See also + See also <function>socket_accept</function>, <function>socket_bind</function>, <function>socket_connect</function>, <function>socket_listen</function>, - <function>socket_strerror</function>, and - <function>socket_write</function>. + <function>socket_last_error</function>, + <function>socket_strerror</function> and + <function>socket_write</function>. </para> </refsect1> </refentry>