Method

GioNetworkMonitorget_connectivity

Declaration

GNetworkConnectivity
g_network_monitor_get_connectivity (
  GNetworkMonitor* monitor
)

Description

Gets a more detailed networking state than g_network_monitor_get_network_available().

If GNetworkMonitor:network-available is FALSE, then the connectivity state will be G_NETWORK_CONNECTIVITY_LOCAL.

If GNetworkMonitor:network-available is TRUE, then the connectivity state will be G_NETWORK_CONNECTIVITY_FULL (if there is full Internet connectivity), G_NETWORK_CONNECTIVITY_LIMITED (if the host has a default route, but appears to be unable to actually reach the full Internet), or G_NETWORK_CONNECTIVITY_PORTAL (if the host is trapped behind a “captive portal” that requires some sort of login or acknowledgement before allowing full Internet access).

Note that in the case of G_NETWORK_CONNECTIVITY_LIMITED and G_NETWORK_CONNECTIVITY_PORTAL, it is possible that some sites are reachable but others are not. In this case, applications can attempt to connect to remote servers, but should gracefully fall back to their “offline” behavior if the connection attempt fails.

Available since:2.44

Return value

Type: GNetworkConnectivity

The network connectivity state.