Add function 'settimeout' to class SSLSocket
Description
After wrapping a micropython socket to get a SSLSocket, the function 'settimeout()' fails, reporting that feature doesn't exist (same with 'gettimeout()'). Interestingly though, the 'setblocking()' function does exist and seemingly work.
AttributeError: 'SSLSocket' object has no attribute 'settimeout'
Code Size
Irrelevant (the feature was most likely already supposed to be there but overlooked?)
Implementation
I hope the MicroPython maintainers or community will implement this feature
Code of Conduct
Yes, I agree
[MODERATOR: This topic may have been better posted under 'micropython-lib' instead of plain micropython...
ESP8266: type object 'socket' has not attribute 'timeout'
I am running micropython 1.8.6 on a Wemos D1 mini v1.
I have an application that uses UDP sockets. It runs but I have a problem catching timeout exceptions. This code:
from machine import UART
import socket
uart = UART(0, 115200)
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.settimeout(2.0)
s.bind(("", 9999))
try:
s.receive(10)
except socket.timeout:
uart.write("Exception caught\n")
throws:
Traceback (most recent call last):
File "main.py", line 12, in <module>
AttributeError: type object 'socket' has no attribute 'timeout'
Instead of catching the exception.