From c9304ff35c04e2a4163c4e5fedcbf1bc02fa05b3 Mon Sep 17 00:00:00 2001 From: Georg Richter Date: Tue, 8 Jan 2002 05:55:08 +0000 Subject: [PATCH] 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 --- functions/sockets.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/functions/sockets.xml b/functions/sockets.xml index c9bf2d9f3e..1ff5c06da5 100644 --- a/functions/sockets.xml +++ b/functions/sockets.xml @@ -1,5 +1,5 @@ - + Socket functions Sockets @@ -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"; socket_read - Read from a socket + Reads from a socket Description - int socket_read + mixed socket_read resource socket_des int length int type @@ -429,7 +428,8 @@ echo "OK.\n\n"; socket_des created by the socket_accept function the number of bytes set by length. Otherwise you can use \n, \t or \0 to - end reading. Returns the bytes that were read. + end reading. Returns data, or FALSE if + socket_read failed. Optional type parameter is a named constant: