← index #716Issue #840
Related · high · value 1.690
QUERY · ISSUE

MQTT Disconnect socket write then close

openby AngeloFaticaopened 2023-08-16updated 2023-08-16

When there are network issues and I want to disconnect from mqtt client, the socket writes are blocking and cannot be changed (I havent been successful) so it will just hang on the self.sock.write(b"\xe0\0") line in the disconnect function of simple.py. Is this a necessary action, or can I not write that byte array and just close the socket so that I do not have to worry about hanging on the write indefinitely?

CANDIDATE · ISSUE

umqtt.simple - socket connection timeout parameter

closedby martin-obertopened 2024-04-04updated 2024-10-30

Is there option to setup the timeout that the socket will wait until connection is established?
Similar to: socket.settimeout(value)

https://github.com/micropython/micropython-lib/blob/45ead11f965ddad664b8efe380d83155859e653b/micropython/umqtt.simple/umqtt/simple.py#L63

2 comments
dpgeorge · 2024-10-18

See #890 for a patch for this.

martin-obert · 2024-10-19

Thanks

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