← index #18531Issue #2769
Related · medium · value 0.131
QUERY · ISSUE

Add function 'settimeout' to class SSLSocket

openby magnus-0opened 2025-12-08updated 2026-03-09
enhancementextmod

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...

CANDIDATE · ISSUE

ESP8266: type object 'socket' has not attribute 'timeout'

closedby jeancfopened 2017-01-07updated 2017-01-18

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.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied