socket.inet_aton - bug?
Uwe Mayer
merkosh at hadiko.de
Wed Jun 12 13:45:24 EDT 2002
Hi,
socket.inet_ntoa() accepts the string '\xff\xff\xff\xff' which is
excactly the same i'd expect socket.inet_aton('255.255.255.255') to
produce if it accepted the string '255.255.255.255' as an IP adress.
socket.inet_aton() dies with socket.error "illegal IP adress".
i know this is no valid ip adress, but it is a valid netmask. the
purpose of converting the netmask to a binary format was that i wanted
to isolate the subnet of an ip adress.
i wanted to use test_ip & netmask == ip_range to allow subnets to access
a tcp server.
is there another way of controlling this or why does socket.inet_aton()
behave like that?
Ciao
Uwe
More information about the Python-list
mailing list