Fsockopen and fgets problem. I'm lost need help
| From: | Latex Master | Date: | Thu, 08 Aug 2002 11:39:19 +0000 |
| Subject: | Fsockopen and fgets problem. I'm lost need help | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-111628@lists.php.net to get a copy of this message | ||
Hello PHP,
Dear all i'm trying to run an application using sockets.
The script follows:
$ns=fsockopen(news,119, &$errno, &$errstr, 30);
if (!$ns) {
echo "$errstr ($errno)<br>\n";
} else {
echo fgets($ns, 100)."<br>";
fputs ($ns, "mode reader \r\n");
echo fgets($ns)."<br>";
fputs ($ns, "list\r\n");
while (fgets($ns, 100000) !== "."){
echo fgets($ns, 100000)."<br>";
}
echo "Done";
//}
fclose ($ns);
}
The server at the end of the list returns "." But the script halts
and keeps running until i get
400 Service discontinued: Success, that means server droped
connection due to time out. or maximum script execution time
reached.
tried to replace
while (fgets($ns, 100000) !== ".") with
while (!feof($ns))
still have the same problem.
Please help....
--
Best regards,
Latex mailto:freeman@submission.org.ru