Re: low level data types

2006-02-15 Thread dementrio
> Have you actually _read_ the struct documentation? Ok, sorry about that. Somehow I managed to notice only that "By default, C numbers are represented in the machine's native format and byte order". Now I'm just going to RTFM and stay silent. -- http://mail.python.org/mailman/listinfo/python-l

Re: low level data types

2006-02-15 Thread dementrio
Thanks for the hint! However now I have another problem - endianness (the client runs on powerpc, the server on x86). I found that simply reversing the stuff I recv() works, but is there any cleaner way for taking care of this? -- http://mail.python.org/mailman/listinfo/python-list

low level data types

2006-02-15 Thread dementrio
How can I handle low-level data types in Python? What I want to do is writing an interface to a C daemon which waits for stuff like unsigned ints on a socket. For example, I need to craft and decode data structures that look like this: 32-bit unsigned int MSG_LENGTH 32-bit unsigned int MSG_CODE 64