Hi Jannik,
Thanks a lot for some insight, it has already given me some some idea and I've already noticed that the disconnect is slow however it is not that critical in my situation.
Besides that, I am confused on one thing. You said
If the connection gets lost (remove first switch while target is still connected to second switch), IP_MQTT_CLIENT_Publish() will not return -1.
But, I get r < 0 regardless which switch is disconnected. To be more specific;
- If the switch directly connected to my device is removed, I get r < 0 immediately by press of a button.
- If the far switch is removed from the LAN, I get r < 0 after a certain time, say 5 seconds or so after press of a button.
In general it is not easy to detect if another device lost its connection without sending/receiving a message
Yeah, I get that, I might give a try to sending regular ping from an independent task and listen it back.
Best regards,
Sener