Package ch.bailu.gtk.gio
Klasse NetworkMonitor
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.type.PropertyHolder
ch.bailu.gtk.type.Interface
ch.bailu.gtk.gio.NetworkMonitor
- Alle implementierten Schnittstellen:
PointerInterface
`GNetworkMonitor` provides an easy-to-use cross-platform API
for monitoring network connectivity. On Linux, the available
implementations are based on the kernel's netlink interface and
on NetworkManager.
There is also an implementation for use inside Flatpak sandboxes.
for monitoring network connectivity. On Linux, the available
implementations are based on the kernel's netlink interface and
on NetworkManager.
There is also an implementation for use inside Flatpak sandboxes.
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypKlasseBeschreibungstatic interface
static interface
Von Klasse geerbte verschachtelte Klassen/Schnittstellen ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Feldübersicht
FelderVon Klasse geerbte Felder ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungboolean
canReach
(SocketConnectable 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.void
canReachAsync
(SocketConnectable connectable, Cancellable cancellable, NetworkMonitor.OnAsyncReadyCallback callback, Pointer user_data) Asynchronously attempts to determine whether or not the host
pointed to by @connectable can be reached, without actually
trying to connect to it.boolean
canReachFinish
(AsyncResult result) Finishes an async network connectivity test.static ClassHandler
int
Gets a more detailed networking state than
g_network_monitor_get_network_available().static NetworkMonitor
Gets the default #GNetworkMonitor for the system.static int
boolean
Checks if the network is available.boolean
Checks if the network is metered.static long
static TypeSystem.TypeSize
static long
static TypeSystem.TypeSize
Connect to signal "network-changed".Von Klasse geerbte Methoden ch.bailu.gtk.type.PropertyHolder
getBooleanProperty, getIntProperty, getObjectProperty, getStringProperty, getStrProperty, setBooleanProperty, setIntProperty, setObjectProperty, setStringProperty, setStrProperty
Von Klasse geerbte Methoden ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Von Klasse geerbte Methoden ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Von Klasse geerbte Methoden ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Von Klasse geerbte Methoden java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Von Schnittstelle geerbte Methoden ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Felddetails
-
SIGNAL_ON_NETWORK_CHANGED
- Siehe auch:
-
-
Konstruktordetails
-
NetworkMonitor
-
-
Methodendetails
-
getClassHandler
-
canReach
public boolean canReach(@Nonnull SocketConnectable connectable, @Nullable Cancellable cancellable) throws AllocationError 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().- Parameter:
connectable
- a #GSocketConnectablecancellable
- a #GCancellable, or %NULL- Gibt zurück:
- %TRUE if @connectable is reachable, %FALSE if not.
- Löst aus:
AllocationError
-
canReachAsync
public void canReachAsync(@Nonnull SocketConnectable connectable, @Nullable Cancellable cancellable, NetworkMonitor.OnAsyncReadyCallback callback, @Nullable Pointer user_data) 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.- Parameter:
connectable
- a #GSocketConnectablecancellable
- a #GCancellable, or %NULLcallback
- a #GAsyncReadyCallback to call when the request is satisfieduser_data
- the data to pass to callback function
-
canReachFinish
Finishes an async network connectivity test.
See g_network_monitor_can_reach_async().- Parameter:
result
- a #GAsyncResult- Gibt zurück:
- %TRUE if network is reachable, %FALSE if not.
- Löst aus:
AllocationError
-
getConnectivity
public int getConnectivity()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.- Gibt zurück:
- the network connectivity state
-
getNetworkAvailable
public boolean 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 #GNetworkMonitor:network-available for more details.- Gibt zurück:
- whether the network is available
-
getNetworkMetered
public boolean getNetworkMetered()Checks if the network is metered.
See #GNetworkMonitor:network-metered for more details.- Gibt zurück:
- whether the connection is metered
-
onNetworkChanged
Connect to signal "network-changed".
SeeNetworkMonitor.OnNetworkChanged.onNetworkChanged(boolean)
for signal description.
FieldSIGNAL_ON_NETWORK_CHANGED
contains original signal name and can be used as resource reference.- Parameter:
signal
- callback function (lambda).- Gibt zurück:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
getDefault
Gets the default #GNetworkMonitor for the system.- Gibt zurück:
- a #GNetworkMonitor, which will be a dummy object if no network monitor is available
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-