Why is being connected dependent on having data? #31
Unanswered
marcelstoer
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Maybe one of these links will give you an answer: |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have an MQTT PubSubClient over TLS+Ethernet using SSLClient and this library.
I am currently debugging weird warn/error messages from the SSLClient upon disconnecting from MQTT.
PubSubClient#disconnect()
does thisSource: https://github.com/knolleary/pubsubclient/blob/master/src/PubSubClient.cpp#L660-L668
Upon flushing, the SSLClient then checks for the Ethernet client
getWriteError() || !connected()
in which case it prints this "Error writing to m_client" messages. I verified thatgetWriteError()
returns 0 but....This library's
connected()
confuses me:https://github.com/jandrassy/EthernetENC/blob/a0393889ea90ea17e7ab8c33c759e1d6f16748e1/src/EthernetClient.cpp#L139
It assumes that if "no data, then disconnected", correct?
I confirmed that in my case
if (data) -> false
. However, I think it is expected that there is no data. The PubSub client consumed all MQTT messages by the time it initiates the disconnect. Hence, no data.Maybe my reasoning above is flawed somewhere?
The same happens when reading data from an HTTPS connection using that SSLClient.
-> once we're done reading there's no more data available but since Ethernet client
connected()
checks whether there is data (and returns false) the SSLClient thinks we're disconnectedBeta Was this translation helpful? Give feedback.
All reactions