#20134 [Fbk->NoF]: read from UDP results wrong data

From: Date: Thu, 14 Nov 2002 07:47:58 +0000
Subject: #20134 [Fbk->NoF]: read from UDP results wrong data
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-24859@lists.php.net to get a copy of this message
ID: 20134 Updated by: sniper@php.net Reported By: alberty@neptunelabs.de -Status: Feedback +Status: No Feedback Bug Type: Sockets related Operating System: i686-pc-linux-gnu PHP Version: 4CVS-2002-10-28 New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. Previous Comments: ------------------------------------------------------------------------ [2002-10-28 10:01:12] wez@php.net 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. ------------------------------------------------------------------------ [2002-10-28 08:38:20] alberty@neptunelabs.de 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

« previous php.bugs (#24859) next »