#28741 [Opn->Csd]: fread() - end of UDP packets

From: Date: Sat, 24 Jul 2004 16:54:26 +0000
Subject: #28741 [Opn->Csd]: fread() - end of UDP packets
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-63467@lists.php.net to get a copy of this message
ID: 28741 User updated by: iqomm at users dot sourceforge dot net Reported By: iqomm at users dot sourceforge dot net -Status: Open +Status: Closed Bug Type: *Network Functions Operating System: Windows XP, Apache 1.3.27 PHP Version: 5.0.0RC2 New Comment: Seems to be fixed in 5.0 final and later (CVS). Closing. Previous Comments: ------------------------------------------------------------------------ [2004-06-13 14:02:12] iqomm at users dot sourceforge dot net Changed OS: All (?) to OS: Windows XP, Apache 1.3.27 ------------------------------------------------------------------------ [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

« previous php.bugs (#63467) next »