socket.setdefaulttimeout doesn't work in Windows - any updates?
#1
This issue was raised a couple of years ago - http://trac.xbmc.org/ticket/10960 - and I've noticed that at least some of the current plugins that use setdefaulttimeout, don't call it when running under Windows.

E.g. from the bbc iplayer plugin:
Code:
.       environment = os.environ.get( "OS", "xbox" )
        try:
            timeout = int(__addon__.getSetting('socket_timeout'))
        except:
            timeout = 5
        if environment in ['Linux', 'xbox'] and timeout > 0:
            setdefaulttimeout(timeout)

Is this still necessary? Is there a best practice documented for this? E.g. the bbc iplayer seems to exclude all platforms except xbox and those that are linux-based, so what about iOS etc.?
People have been asking me for a Donate button, so if you want to buy me a drink > here it is <
Reply
#2
I think, this is only needed for the xbox. When using urllib2 to receive the response, the default timeout is 5 seconds. You can set the timeout with:
Code:
response = urllib2.urlopen(request,timeout=30)
socket.setdefaulttimeout(timeout) seems to do the same...

cheers,
asde
Reply

Logout Mark Read Team Forum Stats Members Help
socket.setdefaulttimeout doesn't work in Windows - any updates?0