Bug #1725: fgets() in non_bloking mode won't return
| From: | wico at cnh dot nl | Date: | Fri, 16 Jul 1999 07:49:48 +0000 |
| Subject: | Bug #1725: fgets() in non_bloking mode won't return | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-8569@lists.php.net to get a copy of this message | ||
From: wico@cnh.nl
Operating system: Redhat 6.0 kernel 2.2.10
PHP version: 3.0.11
PHP Bug Type: Misbehaving function
Bug description: fgets() in non_bloking mode won't return
This script connect's as a server to a irc server ith blocking mode off so it can do
otherthings while in the loop
But with connecting... it will hang after reading... and only when i let the irc server push many
many data it will continu to function normal...
<?
echo "plop<BR>\n"; flush();
$fp = fsockopen("irc.net.local", 4400);
if ($fp) {
fputs($fp,"PASS :wisky\nSERVER Wico.net.local 1 932044265 932044265 J10 A 0 :plop\n");
set_socket_blocking($fp, 0);
while (1 < 2) {
sleep(1);
echo "reading....";
flush();
$out = fgets($fp, 2);
echo "done<BR>\n"; /* should come here directly, but
isn't */
flush(); /* It's waiting till fgets is finished */
if ($out) {
echo "boe: '$out'<BR>\n";
flush();
}
}
}
?>