Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Kingdombit |
As far as I’m aware, there is no quick way to check for internet access apart from running HTTPClient.connect_to_host
and seeing what it returns. But the problem is… if the first attempt to connect to a specific host fails (offline), all attempts after that point also fail when trying to connect to that same host.
Basically, everything works fine if the first time it is run there IS internet access - it will succeed and fail properly for all following attempts depending if the device is online or not… but if it starts with a failure, being offline, it seems to cache that host as unresolvable and not even try anymore even after the internet is turned on.
This trouble also seems to follow over into HTTPRequest
, which probably uses HTTPClient.connect_to_host
behind the scenes.
I have a particular action that reminds the user to check their internet connection and try again… if they forgot they aren’t online… but this is getting in the way. I’m sure there are some hacky ways to get around it (checking other hosts first before the main one), but this seems like somewhat of a bug… or have no idea what I’m doing, which may very well be possible Any help would be much appreciated!