timeout in socket.gethostbyname()?

Fortepianissimo fortepianissimo at yahoo.com.tw
Sun Dec 7 14:33:22 EST 2003


I've tried using

socket.setdefaulttimeout(timeout)

to set the default timeout to 'timeout' for all sockets. The part
that's not clear to me, is that if this will affect
socket.gethostbyname(). In my observation the timeout setting did not
affect the DNS lookup.

It might be my misunderstanding of the semantics here: would
setdefaulttimeout() only applies to any socket object newly created?
So gethostbyname() doesn't create a new socket (explicitly at least)
so timeout doesn't apply there? What should I do to get the intended
behavior?

Thanks a bunch!




More information about the Python-list mailing list