PDA

View Full Version : UDP bit unpack



mgjjr
12-02-2007, 02:46 PM
This would seem to be a rather simple task but I have not found anything documented that really makes much sense to me. I have a UDP packet that is 35 bytes long. It consists of unsigned integers of varying lengths. For example, the first word is 2 bytes long, the second 1 byte, the third 3 bytes, etc. I have tried using a number of formats but none seem to recover the correct integer values. Help!

mgjjr

my($newmsg, $sock, $MAXLEN);
$MAXLEN = 1024;
while ($sock->recv($newmsg, $MAXLEN)) {.............}