type converion in python

Steve Holden sholden at holdenweb.com
Thu May 29 18:03:23 EDT 2003


"Winnie Poon" <wpoon at generalhydrogen.com> wrote in message
news:mailman.1054154142.27449.python-list at python.org...
> Hi,
>
> I'm writing a socket server in python and I'm having some trouble
converting > the data received.

[etc]

The socket module, in both C and Python, has routines to convert
local-machine 16-bit and 32-bit values into network neutral form and then
back again. Look for ntohl() [network format to host long], ntohs() [network
format to host, short] and the like int he sopcket module documentation.
There are also specific routined to convert string addresses into four-byte
format.

regards
--
Steve Holden                                  http://www.holdenweb.com/
Python Web Programming                 http://pydish.holdenweb.com/pwp/








More information about the Python-list mailing list