socket settimeout problem.
Posted: Wed Jul 27, 2022 6:54 am
Hello,
I'm writing a simple wget script, but when try to connect to non existing IP or device that is offline, sock.connect take too long to rease an error
Wondering am I doing something wrong or it just not work properly.
(tested on micropython version 1.19.1 and 1.18 - same result)
I'm writing a simple wget script, but when try to connect to non existing IP or device that is offline, sock.connect take too long to rease an error
Code: Select all
>>> import usocket as socket
>>> sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> sock.settimeout(2)
>>> sock.connect(("192.168.4.2",80)) // take more than 15 seconds
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 113] ECONNABORTED
(tested on micropython version 1.19.1 and 1.18 - same result)