The use of the ESP8266 in the world of IoT

User avatar
By Ranjith R
#87628
davydnorris wrote:This is the way TCP/IP works unfortunately - the protocol itself is responsible for implementing a way to detect broken connections, there's nothing at the TCP level that does it.

What I have done is to use MQTT protocol, which has a heartbeat that you can set - if the client (or server) misses the heartbeat for too long then the connection is declared dead and can be reported on as part of the protocol. In fact you can personalise the reporting by using MQTT's Last Will and Testament (LWT), which lets a client specify a topic and a message to publish on behalf of the client if the connection is deemed dead.


Thank you!

As of now, the server I'm using having a custom TCP based protocol. If no workarounds available, then I'm planning to replace the server with any available MQTT broker. This could save time.
User avatar
By Ranjith R
#87629
Pablo2048 wrote:Also you can implement TCP Keepalive mechanism (especially designed for this usecase) on Ubuntu side (https://tldp.org/HOWTO/TCP-Keepalive-HO ... rview.html).


Thank you very much!

This is a good solution. Sounds feasible for my current situation. Let me try this one.
User avatar
By Ranjith R
#87630
davydnorris wrote:
Pablo2048 wrote:Also you can implement TCP Keepalive mechanism (especially designed for this usecase) on Ubuntu side (https://tldp.org/HOWTO/TCP-Keepalive-HO ... rview.html).


Yes that should work well, and your Ubuntu server can be enabled to do that.


Thank you!

The server program I'm currently using is a cross platform one(Windows, Ubuntu, Android). Have to try it out on these three platforms.
User avatar
By davydnorris
#87680
Ranjith R wrote:
The server program I'm currently using is a cross platform one(Windows, Ubuntu, Android). Have to try it out on these three platforms.


Each of these will be enabled in a platform independent way, and Windows/Andriod may be a lot more fiddly than the others - as mentioned before, MQTT is platform independent and incorporates a mechanism to directly detect this. It'll be your best long term decision