PythonQt.QtNetwork.QNetworkSession · declarations 001
Back to PythonQt.QtNetwork.QNetworkSession
Closing
instance-attribute
Closing: Any
Connected
instance-attribute
Connected: Any
Connecting
instance-attribute
Connecting: Any
Disconnected
instance-attribute
Disconnected: Any
InvalidConfigurationError
instance-attribute
InvalidConfigurationError: Any
NoBackgroundTrafficPolicy
instance-attribute
NoBackgroundTrafficPolicy: Any
NoPolicy
instance-attribute
NoPolicy: Any
NotAvailable
instance-attribute
NotAvailable: Any
OperationNotSupportedError
instance-attribute
OperationNotSupportedError: Any
Roaming
instance-attribute
Roaming: Any
RoamingError
instance-attribute
RoamingError: Any
SessionAbortedError
instance-attribute
SessionAbortedError: Any
SessionError
instance-attribute
SessionError: type
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.
int('0b100', base=0) 4
UnknownSessionError
instance-attribute
UnknownSessionError: Any
UsagePolicies
instance-attribute
UsagePolicies: type
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.
int('0b100', base=0) 4
UsagePolicy
instance-attribute
UsagePolicy: type
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.
int('0b100', base=0) 4
accept
accept() -> None
X.accept()
Supplemental documentation: Qt 5 reference:
[slot] void QNetworkSession::accept()
Instructs the session to permanently accept the new access point. Once this function has been called the session may not return to the old access point.
The old access point may be closed in the process if there are no other network sessions for it. Therefore any open socket that still uses the old access point may become unusable and should be closed before completing the migration.
Upstream PySide2 reference signatures (binding differences may apply):
accept(self) -> None
Source: https://doc.qt.io/archives/qt-5.15/qnetworksession.html#accept
activeTime
activeTime() -> int
X.activeTime() -> int
Supplemental documentation: Qt 5 reference:
quint64 QNetworkSession::activeTime() const
Returns the number of seconds that the session has been active.
Upstream PySide2 reference signatures (binding differences may apply):
activeTime(self) -> int
Source: https://doc.qt.io/archives/qt-5.15/qnetworksession.html#activeTime
bytesReceived
bytesReceived() -> int
X.bytesReceived() -> int
Supplemental documentation: Qt 5 reference:
quint64 QNetworkSession::bytesReceived() const
Returns the amount of data received in bytes; otherwise 0.
This field value includes the usage across all open network sessions which use the same network interface.
If the session is based on a service network configuration the number of sent bytes across all active member configurations are returned.
This function may not always be supported on all platforms and returns 0. The platform capability can be detected via QNetworkConfigurationManager::DataStatistics.
Note: On some platforms this function may run the main event loop.
Upstream PySide2 reference signatures (binding differences may apply):
bytesReceived(self) -> int
Source: https://doc.qt.io/archives/qt-5.15/qnetworksession.html#bytesReceived
bytesWritten
bytesWritten() -> int
X.bytesWritten() -> int
Supplemental documentation: Qt 5 reference:
quint64 QNetworkSession::bytesWritten() const
Returns the amount of data sent in bytes; otherwise 0.
This field value includes the usage across all open network sessions which use the same network interface.
If the session is based on a service network configuration the number of sent bytes across all active member configurations are returned.
This function may not always be supported on all platforms and returns 0. The platform capability can be detected via QNetworkConfigurationManager::DataStatistics.
Note: On some platforms this function may run the main event loop.
Upstream PySide2 reference signatures (binding differences may apply):
bytesWritten(self) -> int
Source: https://doc.qt.io/archives/qt-5.15/qnetworksession.html#bytesWritten
close
close() -> None
X.close()
Supplemental documentation: Qt 5 reference:
[slot] void QNetworkSession::close()
Decreases the session counter on the associated network configuration. If the session counter reaches zero the active network interface is shut down. This also means that state() will only change from Connected to Disconnected if the current session was the last open session.
If the platform does not support out-of-process sessions calling this function does not stop the interface. In this case stop() has to be used to force a shut down. The platform capabilities can be detected via QNetworkConfigurationManager::capabilities().
Note that this call is asynchronous. Depending on the outcome of this call the results can be enquired by connecting to the stateChanged(), opened() or error() signals.
See also open(), stop(), and isOpen().
Upstream PySide2 reference signatures (binding differences may apply):
close(self) -> None
Source: https://doc.qt.io/archives/qt-5.15/qnetworksession.html#close
closed
closed(*args: Any, **kwargs: Any) -> Any
Native PythonQt.QtNetwork.QNetworkSession.closed; argument details are not documented.
Supplemental documentation: Qt 5 reference:
[signal] void QNetworkSession::closed()
This signal is emitted when the network session has been closed.
Source: https://doc.qt.io/archives/qt-5.15/qnetworksession.html#closed
configuration
configuration() -> Any
X.configuration() -> PythonQt.QtNetwork.QNetworkConfiguration
Supplemental documentation: Qt 5 reference:
QNetworkConfiguration QNetworkSession::configuration() const
Returns the QNetworkConfiguration that this network session object is based on.
See also QNetworkConfiguration.
Upstream PySide2 reference signatures (binding differences may apply):
configuration(self) -> PySide2.QtNetwork.QNetworkConfiguration
Source: https://doc.qt.io/archives/qt-5.15/qnetworksession.html#configuration
connectNotify
connectNotify(signal: Any) -> None
X.connectNotify(signal)
Upstream PySide2 reference signatures (binding differences may apply):
connectNotify(self, signal: PySide2.QtCore.QMetaMethod) -> None
Source: https://doc.qt.io/archives/qt-5.15/qnetworksession.html#connectNotify
destroyed
destroyed(*args: Any, **kwargs: Any) -> Any
Native PythonQt.QtNetwork.QNetworkSession.destroyed; argument details are not documented.
disconnectNotify
disconnectNotify(signal: Any) -> None
X.disconnectNotify(signal)
Upstream PySide2 reference signatures (binding differences may apply):
disconnectNotify(self, signal: PySide2.QtCore.QMetaMethod) -> None
Source: https://doc.qt.io/archives/qt-5.15/qnetworksession.html#disconnectNotify
error
error() -> Any
X.error()
Supplemental documentation: Qt 5 reference:
[signal] void QNetworkSession::error(QNetworkSession::SessionError error)
This signal is emitted after an error occurred. The error parameter describes the error that occurred.
Note: Signal error is overloaded in this class. To connect to this signal by using the function pointer syntax, Qt provides a convenient helper for obtaining the function pointer as shown in this example:
connect(networkSession, QOverload<QNetworkSession::SessionError>::of(&QNetworkSession::error),
[=](QNetworkSession::SessionError error){ /* ... */ });
See also error() and errorString().
QNetworkSession::SessionError QNetworkSession::error() const
Returns the type of error that last occurred.
See also state() and errorString().
Upstream PySide2 reference signatures (binding differences may apply):
error(self) -> PySide2.QtNetwork.QNetworkSession.SessionError
Source: https://doc.qt.io/archives/qt-5.15/qnetworksession.html#error
errorString
errorString() -> str
X.errorString() -> str
Supplemental documentation: Qt 5 reference:
QString QNetworkSession::errorString() const
Returns a human-readable description of the last device error that occurred.
See also error().
Upstream PySide2 reference signatures (binding differences may apply):
errorString(self) -> str
Source: https://doc.qt.io/archives/qt-5.15/qnetworksession.html#errorString
ignore
ignore() -> None
X.ignore()
Supplemental documentation: Qt 5 reference:
[slot] void QNetworkSession::ignore()
This function indicates that the application does not wish to roam the session.
See also migrate().
Upstream PySide2 reference signatures (binding differences may apply):
ignore(self) -> None
Source: https://doc.qt.io/archives/qt-5.15/qnetworksession.html#ignore
interface
interface() -> Any
X.interface() -> PythonQt.QtNetwork.QNetworkInterface
Supplemental documentation: Qt 5 reference:
QNetworkInterface QNetworkSession::interface() const
Returns the network interface that is used by this session.
This function only returns a valid QNetworkInterface when this session is Connected.
The returned interface may change as a result of a roaming process.
See also state().
Upstream PySide2 reference signatures (binding differences may apply):
interface(self) -> PySide2.QtNetwork.QNetworkInterface
Source: https://doc.qt.io/archives/qt-5.15/qnetworksession.html#interface
isOpen
isOpen() -> bool
X.isOpen() -> bool
Supplemental documentation: Qt 5 reference:
bool QNetworkSession::isOpen() const
Returns true if this session is open. If the number of all open sessions is greater
than zero the underlying network interface will remain connected/up.
The session can be controlled via open() and close().
Upstream PySide2 reference signatures (binding differences may apply):
isOpen(self) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qnetworksession.html#isOpen
migrate
migrate() -> None
X.migrate()
Supplemental documentation: Qt 5 reference:
[slot] void QNetworkSession::migrate()
Instructs the session to roam to the new access point. The old access point remains active until the application calls accept().
The newConfigurationActivated() signal is emitted once roaming has been completed.
See also accept().
Upstream PySide2 reference signatures (binding differences may apply):
migrate(self) -> None
Source: https://doc.qt.io/archives/qt-5.15/qnetworksession.html#migrate
newConfigurationActivated
newConfigurationActivated(*args: Any, **kwargs: Any) -> Any
Native PythonQt.QtNetwork.QNetworkSession.newConfigurationActivated; argument details are not documented.
Supplemental documentation: Qt 5 reference:
[signal] void QNetworkSession::newConfigurationActivated()
This signal is emitted once the session has roamed to the new access point. The application may reopen its socket and test the suitability of the new network link. Subsequently it must either accept() or reject() the new access point.
See also accept() and reject().
Source: https://doc.qt.io/archives/qt-5.15/qnetworksession.html#newConfigurationActivated
objectNameChanged
objectNameChanged(*args: Any, **kwargs: Any) -> Any
Native PythonQt.QtNetwork.QNetworkSession.objectNameChanged; argument details are not documented.
open
open() -> None
X.open()
Supplemental documentation: Qt 5 reference:
[slot] void QNetworkSession::open()
Creates an open session which increases the session counter on the underlying network interface. The system will not terminate a network interface until the session reference counter reaches zero. Therefore an open session allows an application to register its use of the interface.
As a result of calling open() the interface will be started if it is not connected/up yet. Some platforms may not provide support for out-of-process sessions. On such platforms the session counter ignores any sessions held by another process. The platform capabilities can be detected via QNetworkConfigurationManager::capabilities().
Note that this call is asynchronous. Depending on the outcome of this call the results can be enquired by connecting to the stateChanged(), opened() or error() signals.
It is not a requirement to open a session in order to monitor the underlying network interface.
See also close(), stop(), and isOpen().
Upstream PySide2 reference signatures (binding differences may apply):
open(self) -> None
Source: https://doc.qt.io/archives/qt-5.15/qnetworksession.html#open
opened
opened(*args: Any, **kwargs: Any) -> Any
Native PythonQt.QtNetwork.QNetworkSession.opened; argument details are not documented.
Supplemental documentation: Qt 5 reference:
[signal] void QNetworkSession::opened()
This signal is emitted when the network session has been opened.
The underlying network interface will not be shut down as long as the session remains open. Note that this feature is dependent on system wide session support.
Source: https://doc.qt.io/archives/qt-5.15/qnetworksession.html#opened
preferredConfigurationChanged
preferredConfigurationChanged(*args: Any, **kwargs: Any) -> Any
Native PythonQt.QtNetwork.QNetworkSession.preferredConfigurationChanged; argument details are not documented.
Supplemental documentation: Qt 5 reference:
[signal] void QNetworkSession::preferredConfigurationChanged(const QNetworkConfiguration \&config, bool isSeamless)
This signal is emitted when the preferred configuration/access point for the session changes. Only sessions which are based on service network configurations may emit this signal. config can be used to determine access point specific details such as proxy settings and isSeamless indicates whether roaming will break the sessions IP address.
As a consequence to this signal the application must either start the roaming process by calling migrate() or choose to ignore() the new access point.
If the roaming process is non-seamless the IP address will change which means that a socket becomes invalid. However seamless mobility can ensure that the local IP address does not change. This is achieved by using a virtual IP address which is bound to the actual link address. During the roaming process the virtual address is attached to the new link address.
Some platforms may support the concept of Forced Roaming and Application Level Roaming (ALR). Forced roaming implies that the platform may simply roam to a new configuration without consulting applications. It is up to the application to detect the link layer loss and reestablish its sockets. In contrast ALR provides the opportunity to prevent the system from roaming. If this session is based on a configuration that supports roaming the application can choose whether it wants to be consulted (ALR use case) by connecting to this signal. For as long as this signal connection remains the session remains registered as a roaming stakeholder; otherwise roaming will be enforced by the platform.
See also migrate(), ignore(), and QNetworkConfiguration::isRoamingAvailable().
Source: https://doc.qt.io/archives/qt-5.15/qnetworksession.html#preferredConfigurationChanged
reject
reject() -> None
X.reject()
Supplemental documentation: Qt 5 reference:
[slot] void QNetworkSession::reject()
The new access point is not suitable for the application. By calling this function the session returns to the previous access point/configuration. This action may invalidate any socket that has been created via the not desired access point.
See also accept().
Upstream PySide2 reference signatures (binding differences may apply):
reject(self) -> None
Source: https://doc.qt.io/archives/qt-5.15/qnetworksession.html#reject
sessionProperty
sessionProperty(key: str) -> Any
X.sessionProperty(key) -> object
Supplemental documentation: Qt 5 reference:
QVariant QNetworkSession::sessionProperty(const QString \&key) const
Returns the value for property key.
A network session can have properties attached which may describe the session in more details. This function can be used to gain access to those properties.
The following property keys are guaranteed to be specified on all platforms:
| Key | Description |
|---|---|
| ActiveConfiguration | If the session isOpen() this property returns the identifier of the QNetworkConfiguration that is used by this session; otherwise an empty string. The main purpose of this key is to determine which Internet access point is used if the session is based on a ServiceNetwork. The following code snippet highlights the difference: QNetworkConfigurationManager mgr; QNetworkConfiguration ap = mgr.defaultConfiguration(); QNetworkSession *session = new QNetworkSession(ap); ... //code activates session QString ident = session->sessionProperty("ActiveConfiguration").toString(); if ( ap.type() == QNetworkConfiguration::ServiceNetwork ) { Q_ASSERT( ap.identifier() != ident ); Q_ASSERT( ap.children().contains( mgr.configurationFromIdentifier(ident) ) ); } else if ( ap.type() == QNetworkConfiguration::InternetAccessPoint ) { Q_ASSERT( ap.identifier() == ident ); } \endcode |
| UserChoiceConfiguration | If the session isOpen() and is bound to a QNetworkConfiguration of type UserChoice, this property returns the identifier of the QNetworkConfiguration that the configuration resolved to when open() was called; otherwise an empty string. The purpose of this key is to determine the real QNetworkConfiguration that the session is using. This key is different from ActiveConfiguration in that this key may return an identifier for either a service network or a Internet access points configurations, whereas ActiveConfiguration always returns identifiers to Internet access points configurations. |
| ConnectInBackground | Setting this property to true before calling open() implies that the connection attempt is made but if no connection can be established, the user is not connsulted and asked to select a suitable connection. This property is not set by default and support for it depends on the platform. |
| AutoCloseSessionTimeout | If the session requires polling to keep its state up to date, this property holds the timeout in milliseconds before the session will automatically close. If the value of this property is -1 the session will not automatically close. This property is set to -1 by default. The purpose of this property is to minimize resource use on platforms that use polling to update the state of the session. Applications can set the value of this property to the desired timeout before the session is closed. In response to the closed() signal the network session should be deleted to ensure that all polling is stopped. The session can then be recreated once it is required again. This property has no effect for sessions that do not require polling. |
See also setSessionProperty().
Upstream PySide2 reference signatures (binding differences may apply):
sessionProperty(self, key: str) -> typing.Any
Source: https://doc.qt.io/archives/qt-5.15/qnetworksession.html#sessionProperty
setSessionProperty
setSessionProperty(key: str, value: Any) -> None
X.setSessionProperty(key, value)
Supplemental documentation: Qt 5 reference:
void QNetworkSession::setSessionProperty(const QString \&key, const QVariant \&value)
Sets the property value on the session. The property is identified using key. Removing an already set property can be achieved by passing an invalid QVariant.
Note that the UserChoiceConfiguration and ActiveConfiguration properties are read only and cannot be changed using this method.
See also sessionProperty().
Upstream PySide2 reference signatures (binding differences may apply):
setSessionProperty(self, key: str, value: typing.Any) -> None
Source: https://doc.qt.io/archives/qt-5.15/qnetworksession.html#setSessionProperty