Packing and unpacking IP addresses into 32-bit integers

Mike Fletcher mcfletch at vrtelecom.com
Mon Aug 9 18:13:15 EDT 1999


Wouldn't it be something like:
	'>bbbb' or '!bbbb'

instead (for portability to non-big-endian machines (I'm assuming the packed
representation is supposed to have network byte order))?

Just a thought,
Mike

-----Original Message-----
From: python-list-request at cwi.nl [mailto:python-list-request at cwi.nl]On
Behalf Of Steven D. Majewski
Sent: August 9, 1999 4:50 PM
To: python-list at cwi.nl
Subject: Re: Packing and unpacking IP addresses into 32-bit integers

...
and use either struct.pack or array to coerce it into a binary string:

  a = apply( struct.pack, [ 'bbbb' ] + adr )





More information about the Python-list mailing list