correcting prototype : sockect_select accepts arrays

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@131115 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Damien Seguy 2003-06-12 01:58:19 +00:00
parent be0a301990
commit e43b472ce8

View file

@ -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>&amp;read</parameter></methodparam>
<methodparam><type>resource</type><parameter>&amp;write</parameter></methodparam>
<methodparam><type>resource</type><parameter>&amp;except</parameter></methodparam>
<methodparam><type>array</type><parameter>&amp;read</parameter></methodparam>
<methodparam><type>array</type><parameter>&amp;write</parameter></methodparam>
<methodparam><type>array</type><parameter>&amp;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 @@ if ($num_changed_sockets === false) {
/* At least at one of the sockets something interesting happened */
}
]]>
</programlisting>
</programlisting>
</example>
</para>
<note>
<para>
@ -76,11 +81,14 @@ if ($num_changed_sockets === false) {
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 @@ socket_select($r, $w, $e = NULL, 0);
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>