Is it possible to set timeout on a getaddrinfo () call in CPIথon 2.7?
Socket Setdefaulttimeout () No works I really do not want a solution that uses threads or threads. A solution which uses only the standard library is best, but the use of third-party package would be acceptable. For example, I want to do this:
Socket Getaddrinfo (""! @ # $% ^ & Amp; () + = - [] \\\ ';,. / { } | \ ": & Lt; & gt ;? ~ _" "", none)
and put a socket in it in 1 second. (Note that when I run it on OS X, it runs out faster anyway, but it takes about 60 seconds to fail to run on Debian).
I understand that the getaddrinfo cover is on the library to provide the OS:
< P> On Unix: int getaddrinfo (const char * node name, const char * servname, const struct addrinfo * hints, struct addrinfo ** res); On Windows: int WSAAPI getaddrinfo (__in_opt PCSTR pNodeName, __in_opt PCSTR pServiceName, __in_opt const ADDRINFOA * pHints, __out PADDRINFOA * ppResult);
None of them uses an expired value and therefore Python can not provide you directly. You either have any code that is using threads or uses a third party library.
Comments
Post a Comment