#18373 [Fbk->NoF]: unread_bytes always 0

From: Date: Wed, 11 Sep 2002 16:37:47 +0000
Subject: #18373 [Fbk->NoF]: unread_bytes always 0
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-19147@lists.php.net to get a copy of this message
ID: 18373 Updated by: sniper@php.net Reported By: webmaster@darkenemy.com -Status: Feedback +Status: No Feedback Bug Type: Sockets related Operating System: Windows Server Platform PHP Version: 4.2.1 New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. Previous Comments: ------------------------------------------------------------------------ [2002-07-24 16:31:09] jason@php.net fsockopen() has changed dramaticly in current CVS with the introduction of streams. Would you mind trying a snapshot to see if your problem still persists? snaps.php.net/win32/ Thanks, -Jason ------------------------------------------------------------------------ [2002-07-16 12:35:35] webmaster@darkenemy.com After creating a blocking socket with fsockopen, I entered an idle loop. I've checked the property unread_bytes of the array returned by socket_get_status. After I got a value of zero bytes, socket_get_status reports always an unread buffer of zero bytes, also when the server sends any data. I checked the server logs and I checked the script without checking socket status. Without checking the socket status, it works wonderful. Sample script: <?php echo "<html><body><pre>\n"; set_time_limit(0); $sock = fsockopen("localhost",6667,$errno,$errstr,30); // Connecting to dummy ircd fputs($sock,"NICK PreProcessor\r\n"); fputs($sock,"USER PHP localhost localhost :HyperText Pre Processor\r\n"); while (!feof($sock)) { // Loop until connection will be closed $stat = socket_get_status($sock); $queue = $stat[unread_bytes]; // How many bytes to read from socket? if ($queue > 0) { $data = chop(fgets($sock,128)); echo $data."\r\n"; flush(); $foo = split("[:]",$data); if ($foo[0] == "PING ") fputs($sock,"PONG :$foo[1]\r\n"); $foo = split("[ ]",$data); if ($foo[1] == "005") fputs($sock,"JOIN #Channel\r\n"); if ($foo[3] == ":die") fputs($sock,"QUIT :EOF\r\n"); // retrieved shutdown script } else { sleep(1); // Sleep one second and do other things } } fclose($sock); // Good bye ... echo "</pre></body></html>\n"; ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=18373&edit=1

« previous php.bugs (#19147) next »