Re: "Byte Array"

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

 



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.

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) {
		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?

Ian

On Tue, 2004-12-14 at 12:12 +0100, Ian Firla wrote:
> You're right. I think it will. Thanks.
> 
> I've got another issue now though which may indeed be a show-stopper.
> 
> It seems that while socket_recvfrom is binary safe, there's no way to
> send data in any way other than a string... Is that right? Can I not
> send data of other types?
> 
> Ian
> 
> On Mon, 2004-12-13 at 07:57 -0800, Chris wrote:
> > Try the unpack function, it should do quite nicely.
> > 
> > Chris
> > 
> > Ian Firla wrote:
> > 
> > >Hello All,
> > >
> > >I've hit a bit of a show stopper in a project I'm working on.
> > >
> > >I'm getting a 65 byte stream of data. 32 of those bytes are of the type
> > >"Byte Array". Is there a way that I can covert that data into something
> > >useful?
> > >
> > >For the record, the data stream that I'm getting is in the format:
> > >
> > >|ascii|ascii|asciiX10|integerX4|byte arrayX32|
> > >
> > >The byte array looks like this: gÃ.ÃÃ.ÃÆÃÃÂÃUâÃAÃÂ9xÅÂÃ|%ÃrÂÃ9â.
> > >
> > >Any ideas?
> > >
> > >Ian
> > >
> > >  
> > >
> > 
> 

-- 
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