Open mfallavol opened 7 years ago
I can confirm that connect() doesn't throw a timeout exception. For me it throws "OSError: -1" after an unspecified amount of time, whether I set a timeout or not.
WiPy 3.0 release 1.18.1.r1
Motivation: Minimise the time network hardware is being used because it consumes a large amount of energy. This is particularly wasteful when using the LTE modem of a GPy, which consumes ~200mA.
WiPy 2.0 v1.8.6-650-g9bacbbd4 on 2017-06-09'
When I attempt to make a socket connection to a machine that is down the timeout value is completely ignored and connect() doesn't throw an exception.
Example code:
import time import socket def test1(): start = time.time() s = socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_TCP) s.settimeout(3) s.connect(('192.168.1.120', 15000)) finish = time.time() print(finish - start) s.close()
This takes 18-19 seconds and throws no exception.