I tried to respond, but the response didn't show up. So I'll try
again.
your statement
Code:
INSLength = RawPacket[8,9];
sets INSLength to the value stored in RawPacket[9].
For your file, the character is '9', which is equal to 0x39.
It
just happens that the length of the body is 0x39 for your
file.
Please do the following:
Temporarily change your Log.txt (save a copy of the original)
so that RawPacket[ 8] will be '4' and RawPacket[ 9] will be '0'.
This means that there should be 40 (hexadecimal) bytes (64 decimal)
in the body.
Now print out the value of INSLength as you did before.
You will see that INSLength is equal to 48 decimal (30 hexadecimal).
This is because RawPacket[ 9] will be 0x30 (the value of '0').
You are reading characters. You must operate on the two characters
in RawPacket[ 8] and RawPacket[ 9] to get the numerical value
represented by these digits.
Dave