NetworkMonitor.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 #GNetworkMonitor: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 gio.types.IOErrorEnum.HostUnreachable).

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 gio.network_monitor.NetworkMonitor.canReachAsync.

Parameters

connectable gio.socket_connectable.SocketConnectable

a #GSocketConnectable

cancellable gio.cancellable.Cancellable

a #GCancellable, or null

Return Value

Type: bool

true if connectable is reachable, false if not.