I'm translating hostname to IPv4 address using gethostbyname()
of socket
in python. Sometimes it takes little extra time to show the IP address. I was wondering if there is any default timeout value for each lookup. Here's how i'm using socket in my program-
try:
addr = socket.gethostbyname(hostname)
except socket.gaierror:
addr = ""
print hostname+" : "+addr
Just need to add another question, is there any chance that this can miss any IP address? Anyone had any experience converting large sample of hostname to IP address?