is there any timeout value for socket.gethostbyname(hostname) in python? -


i'm translating hostname ipv4 address using gethostbyname() of socket in python. takes little time show ip address. wondering if there default timeout value each lookup. here's how i'm using socket in program-

try:     addr = socket.gethostbyname(hostname) except socket.gaierror:     addr = ""  print hostname+" : "+addr 

just need add question, there chance can miss ip address? had experience converting large sample of hostname ip address?

here entire socket time out file.

import socket  try:     _global_default_timeout = socket._global_default_timeout except attributeerror:     _global_default_timeout = object() 

as can see, global_default_timeout = object() creating empty object.

socket.setsocketimeout set default timeout new sockets, if you're not using sockets directly, setting can overwritten.

for more, see this answer.

edit: follow question, yes. made program involved host name ip address conversion, , did have issues missing addresses. not sure if because of timeout. had double check.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -