Is there a portable way to retrieve the local host subnet mask?

Pierre Rouleau prouleau at impathnetworks.com
Wed Dec 10 20:24:34 CET 2003


Hi all,

socket.gethostbyname_ex(socket.gethostname()) will return the list of IP 
addresses on a the local host.   I did not find any function that can be 
used to get the subnet mask and default gateway.

Under Win32, the Win32 IP helper API provides a  GetIpAddrTable() 
function that returns information that contain the subnet mask, but 
that's Win32 level, and is not portable.  Is there something available 
in the Python library for that purpose?


Thanks



Pierre





More information about the Python-list mailing list