NetworkMonitor
#GNetworkMonitor provides an easy-to-use cross-platform API for monitoring network connectivity. On Linux, the available implementations are based on the kernel's netlink interface and on NetworkManager.
There is also an implementation for use inside Flatpak sandboxes.
Since
2.32
Properties
More detailed information about the host's network connectivity. See g_network_monitor_get_connectivity() and #GNetworkConnectivity for more details.
Whether the network is considered available. That is, whether the system has a default route for at least one of IPv4 or IPv6.
Whether the network is considered metered. That is, whether the system has traffic flowing through the default connection that is subject to limitations set by service providers. For example, traffic might be billed by the amount of data transmitted, or there might be a quota on the amount of traffic per month. This is typical with tethered connections (3G and 4G) and in such situations, bandwidth intensive applications may wish to avoid network activity where possible if it will cost the user money or use up their limited quota.
Functions
Attempts to determine whether or not the host pointed to by
Asynchronously attempts to determine whether or not the host pointed to by @connectable can be reached, without actually trying to connect to it.
Finishes an async network connectivity test. See g_network_monitor_can_reach_async().
Emitted when the network configuration changes.
Gets a more detailed networking state than g_network_monitor_get_network_available().
Checks if the network is available. "Available" here means that the system has a default route available for at least one of IPv4 or IPv6. It does not necessarily imply that the public Internet is reachable. See #GNetworkMonitor:network-available for more details.
Checks if the network is metered. See #GNetworkMonitor:network-metered for more details.
Initializes the object implementing the interface.