develooper Front page | perl.perl5.porters | Postings from March 2000

Unpacking a Word Byte.

March 20, 2000 06:57
Unpacking a Word Byte.
Message ID:
Im having difficulty trying to connect to a UDP Socket and using the
unpack function to unpack certain types of packets.

The header to receive consists of:
byte	Version Number
byte	Version Type
word	Query Key
byte	Packet Number	
byte	Packet Totals

I cannot get proper information after Query Key because it seems all my
information I have unpacked so far is offset.

A word from what I have learned is 2 bytes.  That means that
$querykey = unpack("x$bytes_parsed C2", $packet); should work.  Instead of
returning the key, it returns 0 which is an incorrect value.

ps - I can send code if it is required.

Any help is greatly appreciated.

Ian. Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About