in reply to Re^2: Disassembling DNS Packet
in thread Disassembling DNS Packet

unpack "v"? Are you sure? Little-endian? For a network protocol?

Replies are listed 'Best First'.
Re^4: Disassembling DNS Packet
by ikegami (Patriarch) on May 13, 2010 at 20:48 UTC

    It should definitely be 'n'. "When a multi-octet quantity is transmitted[,] the most significant octet is transmitted first."

Re^4: Disassembling DNS Packet
by mpapet (Novice) on May 13, 2010 at 17:23 UTC
    unpack "v"? Are you sure? Little-endian? For a network protocol?

    This is where I need some help.

    my $transid = unpack('n', substr($payload,0,2));

    My script returns "Theres a transid 29754" and dig returns 43785 in a separate terminal.

      There's no relation between 29754 (0x743A) and 43785 (0xAB09). You're trying to unpack the wrong bytes, your expectations are wrong, or both.