"joe shoemaker" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
If you have the following:

     data = unpack('>L', sock.recv(4))

Does this line of code means that incoming data is big endian and
unpack it to endianess of local machine? If local machine is little
endian, then big endian is automatically converted to little endian
format?

thank you.

Try it:

data = unpack('>L','\xaa\xbb\xcc\xdd')
data
(2864434397L,)
hex(data[0])
'0xaabbccddL'
data = unpack('>L','\x11\x22\x33\x44')
data
(287454020,)
hex(data[0])
'0x11223344'


Yes, it treats the incoming data as big-endian. The Python data type returned varies as needed to hold the value. You'd get the same results on a big-endian and little-endian local machine. How the Python data type is represented internally is an implementation detail and could be anything.
--
Mark
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to