[Fwd: Binary UDP support?]
| From: | Evan Klinger | Date: | Tue, 29 Feb 2000 04:51:43 +0000 |
| Subject: | [Fwd: Binary UDP support?] | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-11171@lists.php.net to get a copy of this message | ||
Anyone up for coding binary support?
-------- Original Message --------
Subject: Binary UDP support?
Date: Mon, 28 Feb 2000 23:44:32 -0500
From: "Ian Redden" <iredden@redden.on.ca>
To: <evan715@sirius.com>
Thanks for the help earlier in getting me started on the UDP with
php4b4.
Since then I've been talking to phpbuilder guys about writing them an
article on how todo UDP/TCP sockets in PHP4. Looking further into
php4's
capabilities with sockets, I discovered it does not have binary support
w/
UDP (or it appears that way). I have pasted my code below as a working
example.
<?php
$maxlen = 1024;
$default_host = "171.64.75.234";
$default_port = "28001";
$connection = fsockopen("udp://".$default_host, $default_port, &$errno,
&$errst$
if(!$connection) {
echo "$errstr ($errno)<br>\n";
} else {
$msgsend = "bah";
fputs($connection, $msgsend);
$msgrecv = fgets($connection, $maxlen);
}
# Was writing it to a file to see if it was the browser that didnt
support
the binary. Unfortunately
# PHP4b4pl1 does not appear to have binary support read/write on UDP.
$fp = fopen("binaryjunk", "w");
fwrite($fp, $msgrecv);
fclose($fp);
echo $msgrecv;
fclose($connection);
?>
btw - If this is a problem... any ETA on when binary will be
implimented?