Newbie: implementing lowlevel protocol over socket int32 data handling
Bram
b.neijt at ai.rug.nl
Thu Jul 31 10:54:11 EDT 2003
Hi,
Summ: "What is the best way to handle int8,16 and 32 data in python?"
Im currently working on a class to implement the gui protocol of
mldonkey. (http://mldonkey.lemmster.de/wiki/index.php/GuiProtocol)
However this requires to send int32 and int16 and even int8 integers.
To create data I'm using the work-around of converting everything to hex
values, and then converting the hex values to a data string wich I put
on the socket (e.g. "\x00\xF0").
I could do the same on the recieving end: chop it up in bytes and
convert them to numbers (combining the hi and lo bytes of the int16 with
some calculations)
However, there must be a better way of doing this.
Can anyone help me on this problem?
Bram
More information about the Python-list
mailing list