Is there any way to check if actually my embedded device has a working connection (i.e. can reach the WAN)? My device has no RTOS, so I cannot rely on OS functionalities like ping. I can see that the DHCP gives a correct IP to my device, but it's not 100% true that given a correct IP I can then reach for example www.google.com.

I've already done some research, and there are different approaches:

  1. it's impossible
  2. it's a stupid question
  3. workarounds of every sort, but I feel confident with respect to SO so I'll give it a try.

So, if this is question has 1) or 2) as replies, I'll remove it and it's ok.

  • What are you using the device for? Is the internet connection check to verify the connection works when your primary functionality somehow doesn't?
    – Helmar
    Jun 23, 2018 at 9:39
  • @Helmar I need to be sure that the internet connection is working beacuse I need to access the device from the internet and exchange data with it
    – panc_fab
    Jun 25, 2018 at 8:09
  • 1
    I'm not sure I understand what you're trying to do. Your goal is to access the device at any time from the internet remotely, correct? So you already have an active component under your control on the internet. Why don't you try to reach that component and do whatever you plan to re-establish connectivity if that fails?
    – Helmar
    Jun 25, 2018 at 18:20
  • Yes, I assume that what you are saying could be the smartest thing to do... sometimes I lose myself in problems that are not problems, I'm quite new to the embedded environment and I get confused easily. Thank you! I'll post an answer later on to close the question.
    – panc_fab
    Jun 26, 2018 at 9:21

2 Answers 2


Thanks guys for the support. I've finally used the method described by Helmar in which I just try to reach the desired target and see. If I can obtain a reply from the target, I know that my connection is alive and functioning, otherwise I manage to disconnect the device and retry with a fresh new connection.


I cannot rely on OS functionalities like ping.

Implement ping yourself. You can probably find an example for your platform.

Or contact some service via some other protocol you can support; just don't assume that the service will remain available for the lifetime of the device, unless it's a server you manage.

I need to access the device from the internet and exchange data with it

If your actual goal is to allow inbound traffic, generally that is a bad idea and hard for end users to enable their networks to permit. Instead, you'd typically make/maintain an outbound connection to a server down which it could tunnel or relay vetted incoming traffic intended for your device. You can readily equip the code which makes / maintains / reconnects this tunnel with an output mechanism to indicate its health.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.