pack and unpack problems
Justin Johnson
justinjohnson at fastmail.fm
Tue Jun 17 23:54:22 EDT 2003
That sorta makes sense to me. I'm actually trying to read data sent in a
udp packet, and I can see that the actual data I care about does start
inside a 4 byte boundary. I've got some reading to do.
Thanks for your help.
On Tue, 17 Jun 2003 20:41:44 -0700, "Mike Rovner" <mike at bindkey.com>
said:
> "Justin Johnson" <justinjohnson at fastmail.fm> wrote in message
> news:20030618031443.7E45535B85 at www.fastmail.fm...
> > Would you mind explaining this for me? What do you mean by check
> > alignment? Sorry, this is kinda new for me. In the meantime I'll go
> > read my orielly tcp book. :-)
> >
> > Thanks.
> >
> > > PS. Better use '!xxLxx8c' cause N is network order 4-byte long
> > >
> > > PPS. xxNxxH8 = 1+1+4+1+1+8 = 16, so check alignment!
>
> IIUC long ints (L or N format) probably assumed to be on 4-byte boundary
> (from the struct start?).
> It means that 'actual' format is xxxxLxx8c and if your data are 16 bytes
> long you'll get 'wrong size'
> If it is the case be sure you use '!' to get 16-byte format '!xxLxx8c'
>
> Hope this helps,
> Mike
>
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
More information about the Python-list
mailing list