pack and unpack problems

Mike Rovner mike at bindkey.com
Tue Jun 17 23:41:44 EDT 2003


"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








More information about the Python-list mailing list