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

Unpacking a Word Byte.

From:
bad_inode
Date:
March 20, 2000 06:57
Subject:
Unpacking a Word Byte.
Message ID:
Pine.LNX.4.10.10003200951520.886-100000@server.redden.on.ca
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.




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About