kbr / fritzconnection

Python-Tool to communicate with the AVM Fritz!Box by the TR-064 protocol and the AHA-HTTP-Interface
MIT License
304 stars 59 forks source link

How to check for an actual/active internet connection #84

Closed jneuendorf closed 3 years ago

jneuendorf commented 3 years ago

Hi,

I am using for library to check if - basically - my internet is working or to check when my internet is down, respectively. I am currently using FritzStatus.is_connected but I am not sure if "FritzBox has established an internet-connection" (see the docs) is equivalent to "I can't download anything right now".

The basic idea was to persist the FritzBox's "Online Monitor" and in order to avoid pinging e.g. google to check for an active internet connection.

Thanks in advance! 😁

kbr commented 3 years ago

You can't download anything right now if you are neither physically connected with the provider (is_linked) nor connected with the internet by the provider (is_connected).

However if you are connected you may still not be able to download something. For that the server from where you like to download something must be up and the service to send the data must be active.

Whether the server is up can get checked by ping, but for the service you may need a tool like nmap.

So if FritzStatus.is_connected is True you may be able to download something right now.

jneuendorf commented 3 years ago

Thanks for the quick response. 🙇

So as I understand it, my provider is doing his job iff. is_connected is True.