Re: "Byte Array"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux