|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[1999-06-20 06:49 UTC] sas at cvs dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 08 11:00:02 2026 UTC |
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