P
Panchal V
I have to process a packet, it looks like this :
$str = "\0\0\0\2\0\0\0\1\2\x41\x42";
version -> 2 (first 4 octects)
type -> 1 (next 4 octects)
length -> 1 (next 1 octect)
data -> 'AB' (next 2 octect)
how do i decode this packet??? i want first 4 bytes to be treated as
an Unsigned Integer i.e. version is 2 here in this case...
I tried
$str =~ m/(.{4})(.{4})(.)/;
$version = pack "I", $1;
but doesn't help... HOW CAN I extract fields values???
Thnx
-Neo
$str = "\0\0\0\2\0\0\0\1\2\x41\x42";
version -> 2 (first 4 octects)
type -> 1 (next 4 octects)
length -> 1 (next 1 octect)
data -> 'AB' (next 2 octect)
how do i decode this packet??? i want first 4 bytes to be treated as
an Unsigned Integer i.e. version is 2 here in this case...
I tried
$str =~ m/(.{4})(.{4})(.)/;
$version = pack "I", $1;
but doesn't help... HOW CAN I extract fields values???
Thnx
-Neo