How to receive a data file of unknown length using a python socket?
John Machin
sjmachin at lexicon.net
Sat Jul 18 19:26:21 EDT 2009
On Jul 19, 8:04 am, twgray <twgray2... at gmail.com> wrote:
> send a 4 byte address from the embedded device, how do I convert that,
> in Python, to a 4 byte, or long, number?
struct.unpack() is your friend. Presuming the embedded device is
little-endian, you do:
the_int = struct.unpack('<I', four_bytes)[0]
See http://docs.python.org/library/struct.html
More information about the Python-list
mailing list