Newbie: implementing lowlevel protocol over socket int32 data handling

Bram b.neijt at
Thu Jul 31 16:54:11 CEST 2003

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. (
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?


More information about the Python-list mailing list