Re: "Byte Array"

From: Date: Tue, 14 Dec 2004 16:40:24 +0000
Subject: Re: "Byte Array"
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-204309@lists.php.net to get a copy of this message
Ian Firla wrote: > > Just a follow-up to myself... I decided to try packet sniffing to see > what was going on and ettercap confirms that I'm sending out strings > rather than data of the type stored in my array: > > 16:12:26 192.168.0.101:32779 --> 192.168.0.88:32896 | UDP | > > 0000: 3331 31 > > That "31" should be an integer of only one byte, not two. I suspect that PHP is converting your integers into strings at some point, as you build the array... *WHERE* it is doing that is difficult to say, without seeing more code. > The function that's doing the sending looks like this: > > function send_back($sock, $msg, $ip, $port) { > $fp = fsockopen("udp://$ip", $port, $errno, $errstr); > foreach ($msg as $msg_to_send) { //To confirm my suspicion that you have a string here: error_log("The type of $msg_to_send is " . gettype($msg_to_send)); //Now go check your PHP error log (default: Apache error_log) > fwrite($fp, $msg_to_send); > echo date("H:i:s")." SENT '$msg_to_send'\n"; //seen server > side > } > fclose($fp); > } > > Can anyone see where I might be going wrong? Why am I not sending the > integers as integers and the binary bits as binary bits? -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#204309) next »