#33568 [NEW]: stream_socket_server can't write after feof triggered

From: Date: Mon, 04 Jul 2005 19:04:52 +0000
Subject: #33568 [NEW]: stream_socket_server can't write after feof triggered
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-81378@lists.php.net to get a copy of this message
From: shaun at verticalevolution dot com Operating system: Windows XP SP2 PHP version: 5.0.4 PHP Bug Type: Sockets related Bug description: stream_socket_server can't write after feof triggered Description: ------------ Once the FEOF flag has been triggered on a stream you are unable to then write to that stream. I created a stream_socket_server, accepted a client (stream_socket_accept) then attempted to read all the contents from the stream (while!feof()) I am not able to then write to that same client stream. It appears that once the feof flag has been it the stream is no longer able to be written to. Reproduce code: --------------- SERVER: <?php $sock = stream_socket_server('tcp://127.0.0.1:1899', $errno, $errstr); $read = Array($sock); $i = ''; while(1){ $ready = stream_select($read, $write = NULL, $except = NULL, 10); $c = stream_socket_accept($sock); var_dump(stream_get_meta_data($c)); while(!feof($c)){ $i .= fread($c, 12); } echo $i; fwrite($c, 'testback'); break; } fclose($sock); ?> CLIENT: <?php $output = ''; $sock = stream_socket_client('tcp://127.0.0.1:1899',$errcode, $errstr); fwrite($sock, 'test'); stream_set_timeout($sock, 5); while(!feof($sock)){ $output = fread($sock, 1024); } fclose($sock); echo $output; ?> Expected result: ---------------- On the server I should see "test" printed out then on the client I should see "testback" printed out. -- Edit bug report at http://bugs.php.net/?id=33568&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33568&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33568&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33568&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=33568&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=33568&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33568&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33568&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33568&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33568&r=support Expected behavior: http://bugs.php.net/fix.php?id=33568&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33568&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33568&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=33568&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33568&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=33568&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33568&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33568&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33568&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33568&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33568&r=mysqlcfg

« previous php.bugs (#81378) next »