ID: 20134 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Feedback Bug Type: Sockets related Operating System: i686-pc-linux-gnu PHP Version: 4CVS-2002-10-28 New Comment:
Did it do this with PHP 4.2.3? Also, your test script is not very useful to us because: a) We don't have some unknown UDP service on 33334 b) We don't know what data it sends c) We don't know what data the script receives and thus how it is wrong. Please supply us with more information, and we'll be happy to resolve the problem. Previous Comments: ------------------------------------------------------------------------ [2002-10-28 08:38:20] [EMAIL PROTECTED] Hi, If you open an UDP connection to a non open udp port with fsockopen, fread reads the requested length, but the content is sometimes wrong (nonsensical data) This short script demonstrate the problem: <?php header ('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0, no-risk, no-fun'); header ('Pragma: no-cache'); // Please replace the ip address with an existing host $fp = fsockopen("udp://192.168.0.1", 33334, $errno, $errstr); if (!$fp) { echo "ERROR: $errno - $errstr<br>\n"; } else { fwrite($fp,"\n"); $content=fread($fp, 40); echo "<hr>read length: ".strlen($content)."<hr>"; echo $content."<hr>"; echo bin2hex($content)."<hr>"; fclose($fp); } echo "Finished @ ".time(); ?> I've test it with the lastest cvs version (28.10.2002) Regards, Steve ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20134&edit=1