dams Wed Jun 11 21:58:19 2003 EDT
Modified files:
/phpdoc/en/reference/sockets/functions socket-select.xml
Log:
correcting prototype : sockect_select accepts arrays
Index: phpdoc/en/reference/sockets/functions/socket-select.xml
diff -u phpdoc/en/reference/sockets/functions/socket-select.xml:1.8
phpdoc/en/reference/sockets/functions/socket-select.xml:1.9
--- phpdoc/en/reference/sockets/functions/socket-select.xml:1.8 Wed May 14 10:44:18
2003
+++ phpdoc/en/reference/sockets/functions/socket-select.xml Wed Jun 11 21:58:19
2003
@@ -1,24 +1,27 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.8 $ -->
+<!-- $Revision: 1.9 $ -->
<!-- splitted from ./en/functions/sockets.xml, last change in rev 1.27 -->
<refentry id="function.socket-select">
<refnamediv>
<refname>socket_select</refname>
- <refpurpose>Runs the select() system call on the given arrays of sockets with a
timeout specified by tv_sec and tv_usec </refpurpose>
+ <refpurpose>
+ Runs the select() system call on the given arrays of sockets
+ with a specified timeout
+ </refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>socket_select</methodname>
- <methodparam><type>resource</type><parameter>&read</parameter></methodparam>
-
<methodparam><type>resource</type><parameter>&write</parameter></methodparam>
-
<methodparam><type>resource</type><parameter>&except</parameter></methodparam>
+ <methodparam><type>array</type><parameter>&read</parameter></methodparam>
+ <methodparam><type>array</type><parameter>&write</parameter></methodparam>
+ <methodparam><type>array</type><parameter>&except</parameter></methodparam>
<methodparam><type>int</type><parameter>tv_sec</parameter></methodparam>
<methodparam
choice="opt"><type>int</type><parameter>tv_usec</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
- The <function>socket_select</function> accepts arrays of sockets and
+ <function>socket_select</function> accepts arrays of sockets and
waits for them to change status. Those coming with BSD sockets background
will recognize that those socket resource arrays are in fact the
so-called file descriptor sets. Three independent arrays of socket
@@ -53,8 +56,9 @@
<function>socket_select</function> returns.
</para>
<para>
- Example:
- <programlisting role="php">
+ <example>
+ <title><function>socket_select</function> example</title>
+ <programlisting role="php">
<![CDATA[
/* Prepare the read array */
$read = array($socket1, $socket2);
@@ -67,7 +71,8 @@
/* At least at one of the sockets something interesting happened */
}
]]>
- </programlisting>
+ </programlisting>
+ </example>
</para>
<note>
<para>
@@ -76,11 +81,14 @@
which expects this parameter to be passed by reference. Instead use a
temporary variable or an expression with the leftmost member being a
temporary variable:
- <programlisting role="php">
+ <example>
+ <title>Using &null; with <function>socket_select</function></title>
+ <programlisting role="php">
<![CDATA[
socket_select($r, $w, $e = NULL, 0);
]]>
- </programlisting>
+ </programlisting>
+ </example>
</para>
</note>
<para>
@@ -105,14 +113,17 @@
Be sure to use the <literal>===</literal> operator when checking for an
error. Since the <function>socket_select</function> may return 0 the
comparison with <literal>==</literal> would evaluate to &true;:
- <programlisting role="php">
+ <example>
+ <title>Understanding <function>socket_select</function>'s result</title>
+ <programlisting role="php">
<![CDATA[
if (false === socket_select($r, $w, $e = NULL, 0)) {
echo "socket_select() failed, reason: " .
socket_strerror(socket_last_error()) . "\n";
}
]]>
- </programlisting>
+ </programlisting>
+ </example>
</para>
</note>
<note>
--
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php