#20134 [Opn->Fbk]: read from UDP results wrong data
| From: | wez@php.net | Date: | Mon, 28 Oct 2002 16:01:13 +0000 |
| Subject: | #20134 [Opn->Fbk]: read from UDP results wrong data | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-23563@lists.php.net to get a copy of this message | ||
ID: 20134
Updated by: wez@php.net
Reported By: alberty@neptunelabs.de
-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] 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