IP address to binary conversion
Jeroen Wolff
jwolff at knoware.nl
Thu Jun 14 01:14:07 EDT 2001
On Thu, 14 Jun 2001 02:01:14 +0200, Rikard Bosnjakovic <bos at hack.org>
wrote:
>Here's a solution for the reverse:
>
>>>> socket.inet_ntoa(struct.pack("!I", long(1074015239)))
>'64.4.44.7'
Thanks for the solution!
But when i try: interpret_addr("195.7.145.2") --> -1022914302
the result is an signed long.
So the way back is not good....
Is there a way to make it unsigned? ( a 32 bits unsigned value needed)
Jeroen
More information about the Python-list
mailing list