iblrig.tools.internet_available
- iblrig.tools.internet_available(host='8.8.8.8', port=53, timeout=3, force_update=False)[source]
Check if the internet connection is available.
This function checks if an internet connection is available by attempting to establish a connection to a specified host and port. It will use a cached result if the latter is available and force_update is set to False.
- Parameters:
host (
str
, optional) – The IP address or domain name of the host to check the connection to. Default is “8.8.8.8” (Google’s DNS server).port (
int
, optional) – The port to use for the connection check. Default is 53 (DNS port).timeout (
int
, optional) – The maximum time (in seconds) to wait for the connection attempt. Default is 3 seconds.force_update (
bool
, optional) – If True, force an update and recheck the internet connection even if the result is cached. Default is False.
- Returns:
True if an internet connection is available, False otherwise.
- Return type:
- Parameters: