georg           Tue Jan  8 00:55:09 2002 EDT

  Modified files:              
    /phpdoc/en/functions        sockets.xml 
  Log:
  
  fixed Bug 14894 (examples and function prototype for socket_read)
  
  
Index: phpdoc/en/functions/sockets.xml
diff -u phpdoc/en/functions/sockets.xml:1.28 phpdoc/en/functions/sockets.xml:1.29
--- phpdoc/en/functions/sockets.xml:1.28        Wed Jan  2 06:45:00 2002
+++ phpdoc/en/functions/sockets.xml     Tue Jan  8 00:55:08 2002
@@ -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 @@
         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 @@
 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 @@
   <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 @@
      <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:


Reply via email to