From: [EMAIL PROTECTED] Operating system: i686-pc-linux-gnu PHP version: 4CVS-2002-10-28 PHP Bug Type: Sockets related Bug description: read from UDP results wrong data
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 bug report at http://bugs.php.net/?id=20134&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=20134&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=20134&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=20134&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=20134&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=20134&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=20134&r=support Expected behavior: http://bugs.php.net/fix.php?id=20134&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=20134&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=20134&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=20134&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20134&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=20134&r=dst IIS Stability: http://bugs.php.net/fix.php?id=20134&r=isapi