Replies: 2 comments 3 replies
-
To close the socket associated with a stream issue await stream_instance.wait_closed() At least that is how it's done in MicroPython. I would expect this to be correct in CPython. As a general comment on |
Beta Was this translation helpful? Give feedback.
-
Much as I like and use streams I don't think they are the best way to deal with complex protocols like MQTT. There are reasons why I used nonblocking sockets in the design of However, to answer your question. If you have a task that reads a stream you can subject it to a timeout with If you cancel a stream read with a timeout you need to consider whether there may be circumstances where characters are left on the stream. As a very general point if I were writing an asynchronous MQTT client using streams I'm not sure I'd use |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I tried to port mqtt_as to cpython for easier testing. sockets are replaced with streams. I have the following question on micro-python:
read()
inmqtt.connect()
occasionally hang when tested in practically unstable network.wait_for()
onsr.read()
, what would happen to socket?Why the error raise byasyncio.TimeoutErrorwait_for()
has no exception infoex.args
=()
, is this expected ?Beta Was this translation helpful? Give feedback.
All reactions