NetworkMonitorIF

GNetworkMonitor provides an easy-to-use cross-platform API for monitoring network connectivity. On Linux, the implementation is based on the kernel's netlink interface.

Members

Functions

addOnNetworkChanged
void addOnNetworkChanged(void delegate(gboolean, NetworkMonitorIF) dlg, ConnectFlags connectFlags)

Emitted when the network configuration changes. If available is TRUE, then some hosts may be reachable that were not reachable before, while others that were reachable before may no longer be reachable. If available is FALSE, then no remote hosts are reachable. Since 2.32

canReach
int canReach(SocketConnectableIF connectable, Cancellable cancellable)

Attempts to determine whether or not the host pointed to by connectable can be reached, without actually trying to connect to it. This may return TRUE even when "network-available" is FALSE, if, for example, monitor can determine that connectable refers to a host on a local network. If monitor believes that an attempt to connect to connectable will succeed, it will return TRUE. Otherwise, it will return FALSE and set error to an appropriate error (such as G_IO_ERROR_HOST_UNREACHABLE). Note that although this does not attempt to connect to connectable, it may still block for a brief period of time (eg, trying to do multicast DNS on the local network), so if you do not want to block, you should use g_network_monitor_can_reach_async(). Since 2.32

canReachAsync
void canReachAsync(SocketConnectableIF connectable, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)

Asynchronously attempts to determine whether or not the host pointed to by connectable can be reached, without actually trying to connect to it. For more details, see g_network_monitor_can_reach(). When the operation is finished, callback will be called. You can then call g_network_monitor_can_reach_finish() to get the result of the operation.

canReachFinish
int canReachFinish(AsyncResultIF result)

Finishes an async network connectivity test. See g_network_monitor_can_reach_async().

getNetworkAvailable
int getNetworkAvailable()

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 "network-available" for more details. Since 2.32

getNetworkMonitorTStruct
GNetworkMonitor* getNetworkMonitorTStruct()
Undocumented in source.
getStruct
void* getStruct()

the main Gtk struct as a void*

Properties

onNetworkChangedListeners
void delegate(gboolean, NetworkMonitorIF)[] onNetworkChangedListeners [@property getter]

Static functions

getDefault
NetworkMonitorIF getDefault()

Gets the default GNetworkMonitor for the system. Since 2.32

Meta