fixed Bug 14894 (examples and function prototype for socket_read)

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@67267 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Georg Richter 2002-01-08 05:55:08 +00:00
parent 5c79b55794
commit c9304ff35c

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.28 $ -->
<!-- $Revision: 1.29 $ -->
<reference id="ref.sockets">
<title>Socket functions</title>
<titleabbrev>Sockets</titleabbrev>
@ -76,13 +76,12 @@ do {
break;
}
do {
$buf = '';
$ret = socket_read ($msgsock, $buf, 2048);
if ($ret < 0) {
$buf = socket_read ($msgsock, 2048);
if ($buf == FALSE) {
echo "socket_read() failed: reason: " . socket_strerror ($ret) . "\n";
break 2;
}
if ($ret == 0) {
if (!$buf) {
break 2;
}
$buf = trim ($buf);
@ -148,7 +147,7 @@ socket_write ($socket, $in, strlen ($in));
echo "OK.\n";
echo "Reading response:\n\n";
while (socket_read ($socket, $out, 2048)) {
while ($out = socket_read ($socket, 2048)) {
echo $out;
}
@ -411,13 +410,13 @@ echo "OK.\n\n";
<refentry id="function.socket-read">
<refnamediv>
<refname>socket_read</refname>
<refpurpose>Read from a socket</refpurpose>
<refpurpose>Reads from a socket</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>int <function>socket_read</function></funcdef>
<funcdef>mixed <function>socket_read</function></funcdef>
<paramdef>resource <parameter>socket_des</parameter></paramdef>
<paramdef>int <parameter>length</parameter></paramdef>
<paramdef>int <parameter><optional>type</optional></parameter></paramdef>
@ -429,7 +428,8 @@ echo "OK.\n\n";
<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 the bytes that were read.
end reading. Returns data, or FALSE if
<function>socket_read</function> failed.
</para>
<para>
Optional <parameter>type</parameter> parameter is a named constant: