DNS lookup

"Martin v. Löwis" martin at v.loewis.de
Sun Mar 9 07:11:01 EST 2003


Alessio Pace wrote:
> Is there a portable way to do a DNS lookup? I am developing in Unix (Linux)
> but I would prefer avoiding the use of Unix specific command line tools. I
> need both translation from machine name to IP and from IP to machine name.
> Thanks.

I recommend to use socket.gethostbyname (or socket.getaddrinfo if you 
need support for IPv6 as well).

Regards,
Martin





More information about the Python-list mailing list