NetworkMonitorT.canReach

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().

template NetworkMonitorT(TStruct)
bool
canReach

Parameters

connectable SocketConnectableIF
cancellable Cancellable

a gio.Cancellable, or NULL

Return Value

Type: bool

TRUE if connectable is reachable, FALSE if not.

Throws

GException on failure.

Meta

Since

2.32