[Twisted-Python] Big/Little-endian problem

Hi All, I am newbie to Twisted. In Twisted, do the user need to take care of the big/little-endian issues? For example, I receive a buffer via UDP which actually represents a unsinged int value. So, how can i convert this buffer[0:1] to unsigned int ? Thanks, Xian

On Tue, Apr 22, 2008 at 7:32 PM, Xian Chen <hoganxian@gmail.com> wrote:
In Twisted, do the user need to take care of the big/little-endian issues?
The basic Twisted protocol system is purely in terms of bytes, represented by the Python 'str' type.
For example, I receive a buffer via UDP which actually represents a unsinged int value. So, how can i convert this buffer[0:1] to unsigned int ?
Check out the 'struct' Python module, http://docs.python.org/lib/module-struct.html -- Christopher Armstrong International Man of Twistery http://radix.twistedmatrix.com/ http://twistedmatrix.com/ http://canonical.com/

On Tue, Apr 22, 2008 at 7:32 PM, Xian Chen <hoganxian@gmail.com> wrote:
In Twisted, do the user need to take care of the big/little-endian issues?
The basic Twisted protocol system is purely in terms of bytes, represented by the Python 'str' type.
For example, I receive a buffer via UDP which actually represents a unsinged int value. So, how can i convert this buffer[0:1] to unsigned int ?
Check out the 'struct' Python module, http://docs.python.org/lib/module-struct.html -- Christopher Armstrong International Man of Twistery http://radix.twistedmatrix.com/ http://twistedmatrix.com/ http://canonical.com/
participants (2)
-
Christopher Armstrong
-
Xian Chen