From: Hans Mulder on
joamag wrote:

> It's not my ip address that I want to discover... I want to discover
> my default dns server ip address.
> This ip is stored in an operative system basis.
>
> Dos anyone know how to get it ?

You asked for a cross-platform solution; there probably isn't one.

The code below works on Unix and MacOS X.
If you can find code that works on Windows, you can cobble together
somthing that will work on most platforms.

dns_ips = []

for line in file('/etc/resolv.conf', 'r'):
columns = line.split()
if columns[0] == 'nameserver':
dns_ips.extend(columns[1:])

print dns_ips


Hope this help,

-- HansM