6 years ago.

What is the best known method for handling an unreliable network?

Is there any guidance on how to handle an unreliable network? The approach I am attempting is to create a thread that acts as a network watchdog. It sets a "wait()" for a specified amount of time, and then it checks the network connection. If the connection it alive, it does nothing, but if it's not it calls "connect()" again.

However, the EthernetInterface doesn't have an "alive()" function, or anything like it. I've attempted to use "get_ip_address()", but it returns an IP address even when I know there is no connection.

I'd consider attempting to connect to a random server (google.com or something), but the device I'm creating is running on a local network, and that network may not have a reliable connection to the outside network.

Any ideas?

1 Answer

6 years ago.

Where is the network issue? Is it the physical link layer? If so it should be possible to read something from the phy status register to verify the connection.

If it's a problem with the data transfer over the network then pings to the local gateway or DHCP server would seem like reasonable ways to verify that the network is still functional.

Mostly it's to handle any sort of network intermittency, so it's generally the physical link layer. Is there an API for reading the phy status register? Or is this platform/phy specific?

posted by Derek Miller 20 Apr 2018

Also, how do you construct a ping in the Mbed Networking stack? There does not appear to be an ICMP socket type.

posted by Derek Miller 23 Apr 2018