Virtual Method
GioNetworkMonitorcan_reach
since: 2.32
Declaration [src]
gboolean
can_reach (
GNetworkMonitor* monitor,
GSocketConnectable* connectable,
GCancellable* cancellable,
GError** error
)
Description [src]
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
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().
Available since: 2.32
Parameters
connectable
-
Type:
GSocketConnectable
A
GSocketConnectable
.The data is owned by the caller of the method. cancellable
-
Type:
GCancellable
A
GCancellable
, orNULL
.The argument can be NULL
.The data is owned by the caller of the method. error
-
Type:
GError **
The return location for a recoverable error.
The argument can be NULL
.If the return location is not NULL
, then you must initialize it to aNULL
GError*
.The argument will be left initialized to NULL
by the virtual function if there are no errors.In case of error, the argument will be set to a newly allocated GError
; the caller will take ownership of the data, and be responsible for freeing it.