|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-10-28 10:01 UTC] wez@php.net
[2002-11-14 01:47 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 04 21:00:01 2025 UTC |
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