ID: 18373 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Feedback Bug Type: Sockets related Operating System: Windows Server Platform PHP Version: 4.2.1 New Comment:
Well, that depends on how you use the information. If the goal is to detect a possible block(which looks like what your code is doing), then when that value is 0, there is no data left on the socket. The same is true if blocked is set, and if eof is set. What would your reason be to look at the sytems buffer? -Jason Previous Comments: ------------------------------------------------------------------------ [2002-09-11 11:47:26] [EMAIL PROTECTED] Sorry, I had posted some more feedback. Don't know where it is now. So I'll do again: I tested that CVS build and the result was, that unread_bytes told me the number of bytes, containing the PHP internal socket buffer and not the number of bytes, available on that socket. And I think, that unread_bytes should exactly mean that. Otherwise it would be some less useful. ------------------------------------------------------------------------ [2002-09-11 11:37:46] [EMAIL PROTECTED] 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. ------------------------------------------------------------------------ [2002-07-24 16:31:09] [EMAIL PROTECTED] 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] [EMAIL PROTECTED] 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