On Tue, 2004-12-14 at 08:40 -0800, Richard Lynch wrote: > 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) Thanks Richard. I thought of that too and have since expanded my debugging. The types are correct when passed to fwrite. They come out the other end as strings: 16:39:54 SENT 'K' of type string 16:39:54 SENT '0' of type integer 16:39:54 SENT '0' of type integer 16:39:54 SENT '65' of type integer 16:39:54 SENT '31' of type integer 15:46:10 192.168.0.101:32778 --> 192.168.0.84:32896 | UDP | 0000: 4b K 15:46:10 192.168.0.101:32778 --> 192.168.0.84:32896 | UDP | 0000: 30 0 15:46:10 192.168.0.101:32778 --> 192.168.0.84:32896 | UDP | 0000: 30 0 15:46:10 192.168.0.101:32778 --> 192.168.0.84:32896 | UDP | 0000: 3635 65 15:46:10 192.168.0.101:32778 --> 192.168.0.84:32896 | UDP | 0000: 3331 31 As you can see, the last two elements "65" and "31" have arrived as strings of two bytes rather than integers of one. Ian > > 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 > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php