Bug #1567: socket problem with fsockopen
| From: | smweb at ihost dot de | Date: | Fri, 18 Jun 1999 22:54:52 +0000 |
| Subject: | Bug #1567: socket problem with fsockopen | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-7119@lists.php.net to get a copy of this message | ||
From: smweb@ihost.de
Operating system: SuSE Linux
PHP version: 3.0.8
PHP Bug Type: Misbehaving function
Bug description: socket problem with fsockopen
I have a while loop which opens and closes a socket connection about 100 times:
while (...) {
$fp = fsockopen("myserver.com", 8800);
fputs($fp, $strRequest);
while ($buffer = fgets($fp, 4096)) {
chop($buffer);
$strResultr = $strResult . substr($buffer, 8) . "<br>";
}
fclose($fp);
}
The following happens:
- if I run it like it is above the socket is only opened the first time the while loop is passed
through. In all of the following loops the socket is not opened anymore.
- If I remove the fclose-command, it works. BUT: This way I sometimes get this warning message:
Warning: Unable to find file identifier 0 in /www/ihost.de/htdocs/lexidom/check.html on line 49
Warning: Unable to find file identifier 0 in /www/ihost.de/htdocs/lexidom/check.html on line 54
Line 49 contains:
fputs($fp, $strRequest);
Line 54 contains:
while ($buffer = fgets($fp, 4096)) {
Don't I have to fclose the socket connection? Why doesn't it work when I close it? Why
doesn't it work everytime when I don't close it?
I'd be very thankful for an answer.
- Steffen