QNetworkInformation

QNetworkInformation exposes various network information through native backends. More

Inheritance diagram of PySide6.QtNetwork.QNetworkInformation

Synopsis

Functions

Signals

Static functions

Detailed Description

QNetworkInformation provides a cross-platform interface to network-related information through plugins.

Various plugins can have various functionality supported, and so you can load() plugins based on which features are needed.

QNetworkInformation is a singleton and stays alive from the first successful load() until destruction of the QCoreApplication object. If you destroy and re-create the QCoreApplication object you must call load() again.

See also

Feature

class PySide6.QtNetwork.QNetworkInformation
PySide6.QtNetwork.QNetworkInformation.Reachability

Constant

Description

QNetworkInformation.Reachability.Unknown

If this value is returned then we may be connected but the OS has still not confirmed full connectivity, or this feature is not supported.

QNetworkInformation.Reachability.Disconnected

Indicates that the system may have no connectivity at all.

QNetworkInformation.Reachability.Local

Indicates that the system is connected to a network, but it might only be able to access devices on the local network.

QNetworkInformation.Reachability.Site

Indicates that the system is connected to a network, but it might only be able to access devices on the local subnet or an intranet.

QNetworkInformation.Reachability.Online

Indicates that the system is connected to a network and able to access the Internet.

See also

reachability

PySide6.QtNetwork.QNetworkInformation.Feature

Lists all of the features that a plugin may currently support. This can be used in load() .

Constant

Description

QNetworkInformation.Feature.Reachability

If the plugin supports this feature then the reachability property will provide useful results. Otherwise it will always return Reachability::Unknown. See also Reachability .

QNetworkInformation.Feature.CaptivePortal

If the plugin supports this feature then the isBehindCaptivePortal property will provide useful results. Otherwise it will always return false.

static PySide6.QtNetwork.QNetworkInformation.availableBackends()
Return type

list of strings

Returns a list of the names of all currently available backends.

PySide6.QtNetwork.QNetworkInformation.backendName()
Return type

str

Returns the name of the currently loaded backend.

static PySide6.QtNetwork.QNetworkInformation.instance()
Return type

PySide6.QtNetwork.QNetworkInformation

Returns a pointer to the instance of the QNetworkInformation , if any.

See also

load()

PySide6.QtNetwork.QNetworkInformation.isBehindCaptivePortal()
Return type

bool

This property holds Lets you know if the user’s device is behind a captive portal..

This property indicates if the user’s device is currently known to be behind a captive portal. This functionality relies on the operating system’s detection of captive portals and is not supported on systems that don’t report this. On systems where this is not supported this will always return false.

PySide6.QtNetwork.QNetworkInformation.isBehindCaptivePortalChanged(state)
Parameters

state – bool

static PySide6.QtNetwork.QNetworkInformation.load(features)
Parameters

featuresFeatures

Return type

bool

Load a backend which supports features.

Returns true if it managed to load the requested backend or if it was already loaded. Returns false otherwise

See also

instance

static PySide6.QtNetwork.QNetworkInformation.load(backend)
Parameters

backendQStringView

Return type

bool

Attempts to load a backend whose name matches backend (case insensitively).

Returns true if it managed to load the requested backend or if it was already loaded. Returns false otherwise

See also

instance

PySide6.QtNetwork.QNetworkInformation.reachability()
Return type

Reachability

This property holds The current state of the system’s network connectivity..

Indicates the level of connectivity that can be expected. Do note that this is only based on what the plugin/operating system reports. In certain scenarios this is known to be wrong. For example, on Windows the ‘Online’ check, by default, is performed by Windows connecting to a Microsoft-owned server. If this server is for any reason blocked then it will assume it does not have Online reachability. Because of this you should not use this as a pre-check before attempting to make a connection.

PySide6.QtNetwork.QNetworkInformation.reachabilityChanged(newReachability)
Parameters

newReachabilityReachability

PySide6.QtNetwork.QNetworkInformation.supports(features)
Parameters

featuresFeatures

Return type

bool

Returns true if the currently loaded backend supports features.