Packing and unpacking IP addresses into 32-bit integers

Fred L. Drake, Jr. fdrake at acm.org
Tue Aug 10 18:36:30 CEST 1999


Mike Fletcher writes:
 > 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))?

Mike,
  There are no byte-ordering issues with byte-sized values.  Since the 
x.x.x.x is already in a specific order, the issue doesn't come up at
all here if you're only interested in coverting the dot-notation to &
from the network-byte-order binary structure.


  -Fred

--
Fred L. Drake, Jr.	     <fdrake at acm.org>
Corporation for National Research Initiatives




More information about the Python-list mailing list