Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 7 months 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, 7 months 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.