ID: 28741
User updated by: iqomm at users dot sourceforge dot net
Reported By: iqomm at users dot sourceforge dot net
Status: Open
Bug Type: *Network Functions
-Operating System: All (?)
+Operating System: Windows XP, Apache 1.3.27
PHP Version: 5.0.0RC2
New Comment:
Changed OS: All (?) to OS: Windows XP, Apache 1.3.27
Previous Comments:
------------------------------------------------------------------------
[2004-06-11 15:32:50] iqomm at users dot sourceforge dot net
Description:
------------
I use PHP for some UDP gamequery scripts. Everything works OK in PHP
4.x, but the new PHP 5 RCs' fread() seems to act greedily once again.
Checked the CVS version (Jun 11, 2004 06:30 GM) - the same.
I think it is a duplicate of (or very similar to) Bug #15639 (detecting
end of UDP packets) which was fixed in PHP 4.3.2.
Reproduce code:
---------------
// Just an example query
// :1 - blocking socket
$handle = fsockopen("udp://195.149.21.70", 27015);
fwrite($handle, "\xFF\xFF\xFF\xFFrules\x00");
$data = fread($handle, 8192);
// It just hangs
// :2 - non-blocking socket
$handle = fsockopen("udp://195.149.21.70", 27015);
stream_set_blocking($handle, FALSE);
fwrite($handle, "\xFF\xFF\xFF\xFFrules\x00");
sleep(1);
$data = fread($handle, 8192);
// Returns more than 1 packet
Expected result:
----------------
Should work just as in PHP 4.3.7:
Case 1 - blocking socket:
Returns the less of one packet or max length.
Case 2 - non-blocking:
Returns just one packet.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28741&edit=1