ID: 43325
Updated by: [EMAIL PROTECTED]
Reported By: mertcan at dpozitif dot com
-Status: Open
+Status: Feedback
Bug Type: Streams related
Operating System: Centos 5.0
PHP Version: 5.2.5
New Comment:
Shouldn't you make the stream non-blocking? Try adding this after
fsockopen:
stream_set_blocking($fp, false);
Previous Comments:
------------------------------------------------------------------------
[2007-11-18 23:12:34] mertcan at dpozitif dot com
Description:
------------
Using feof on UDP hangs. It should give true or false, in my example it
should give true but it hangs. I've tried many ways but it always hangs.
Reproduce code:
---------------
$msg = "ÿÿÿÿchallenge rcon";
$fp = fsockopen("udp://62.68.207.16",27015, $errno, $errstr);
fputs($fp, $msg, strlen($msg));
$response = fgets($fp, 1024);
$challenge = substr($response, 19, strlen($response) - 20);
$msg = "ÿÿÿÿrcon ".$challenge." \"123456\" ".$komut.chr(0);
fputs($fp, $msg, strlen($msg));
echo feof($fp) ? 'true':'false';
$response .= fgets($fp, 32);
fclose ($fp);
Expected result:
----------------
true
Actual result:
--------------
hangs
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43325&edit=1