QNetworkAddressEntry¶
The
QNetworkAddressEntry
class stores one IP address supported by a network interface, along with its associated netmask and broadcast address. More…

Synopsis¶
Functions¶
def
__eq__
(other)def
__ne__
(other)def
broadcast
()def
clearAddressLifetime
()def
dnsEligibility
()def
ip
()def
isLifetimeKnown
()def
isPermanent
()def
isTemporary
()def
netmask
()def
prefixLength
()def
setBroadcast
(newBroadcast)def
setDnsEligibility
(status)def
setIp
(newIp)def
setNetmask
(newNetmask)def
setPrefixLength
(length)def
swap
(other)
Detailed Description¶
Each network interface can contain zero or more IP addresses, which in turn can be associated with a netmask and/or a broadcast address (depending on support from the operating system).
This class represents one such group.
-
class
QNetworkAddressEntry
¶ QNetworkAddressEntry(other)
- param other
Constructs an empty
QNetworkAddressEntry
object.Constructs a
QNetworkAddressEntry
object that is a copy of the objectother
.
-
PySide2.QtNetwork.QNetworkAddressEntry.
DnsEligibilityStatus
¶ This enum indicates whether a given host address is eligible to be published in the Domain Name System (DNS) or other similar name resolution mechanisms. In general, an address is suitable for publication if it is an address this machine will be reached at for an indeterminate amount of time, though it need not be permanent. For example, addresses obtained via DHCP are often eligible, but cryptographically-generated temporary IPv6 addresses are not.
Constant
Description
QNetworkAddressEntry.DnsEligibilityUnknown
Qt and the operating system could not determine whether this address should be published or not. The application may need to apply further heuristics if it cannot find any eligible addresses.
QNetworkAddressEntry.DnsEligible
This address is eligible for publication in DNS.
QNetworkAddressEntry.DnsIneligible
This address should not be published in DNS and should not be transmitted to other parties, except maybe as the source address of an outgoing packet.
See also
New in version 5.11.
-
PySide2.QtNetwork.QNetworkAddressEntry.
broadcast
()¶ - Return type
Returns the broadcast address associated with the IPv4 address and netmask. It can usually be derived from those two by setting to 1 the bits of the IP address where the netmask contains a 0. (In other words, by bitwise-OR’ing the IP address with the inverse of the netmask)
This member is always empty for IPv6 addresses, since the concept of broadcast has been abandoned in that system in favor of multicast. In particular, the group of hosts corresponding to all the nodes in the local network can be reached by the “all-nodes” special multicast group (address FF02::1).
See also
-
PySide2.QtNetwork.QNetworkAddressEntry.
clearAddressLifetime
()¶ Resets both the preferred and valid lifetimes for this address. After this call,
isLifetimeKnown()
will returnfalse
.See also
preferredLifetime()
validityLifetime()
isLifetimeKnown()
setAddressLifetime()
-
PySide2.QtNetwork.QNetworkAddressEntry.
dnsEligibility
()¶ - Return type
Returns whether this address is eligible for publication in the Domain Name System (DNS) or similar name resolution mechanisms.
In general, an address is suitable for publication if it is an address this machine will be reached at for an indeterminate amount of time, though it need not be permanent. For example, addresses obtained via DHCP are often eligible, but cryptographically-generated temporary IPv6 addresses are not.
On some systems,
QNetworkInterface
will need to heuristically determine which addresses are eligible.
-
PySide2.QtNetwork.QNetworkAddressEntry.
ip
()¶ - Return type
This function returns one IPv4 or IPv6 address found, that was found in a network interface.
See also
-
PySide2.QtNetwork.QNetworkAddressEntry.
isLifetimeKnown
()¶ - Return type
bool
Returns
true
if the address lifetime is known,false
if not. If the lifetime is not known, bothpreferredLifetime()
andvalidityLifetime()
will returnForever
.See also
preferredLifetime()
validityLifetime()
setAddressLifetime()
clearAddressLifetime()
-
PySide2.QtNetwork.QNetworkAddressEntry.
isPermanent
()¶ - Return type
bool
Returns
true
if this address is permanent on this interface,false
if it’s temporary. A permenant address is one which has no expiration time and is often static (manually configured).If this information could not be determined, this function returns
true
.Note
Depending on the operating system and the networking configuration tool, it is possible for a temporary address to be interpreted as permanent, if the tool did not inform the details correctly to the operating system.
See also
isLifetimeKnown()
validityLifetime()
isTemporary()
-
PySide2.QtNetwork.QNetworkAddressEntry.
isTemporary
()¶ - Return type
bool
Returns
true
if this address is temporary on this interface,false
if it’s permanent.See also
isLifetimeKnown()
validityLifetime()
isPermanent()
-
PySide2.QtNetwork.QNetworkAddressEntry.
netmask
()¶ - Return type
Returns the netmask associated with the IP address. The netmask is expressed in the form of an IP address, such as 255.255.0.0.
For IPv6 addresses, the prefix length is converted to an address where the number of bits set to 1 is equal to the prefix length. For a prefix length of 64 bits (the most common value), the netmask will be expressed as a
QHostAddress
holding the address FFFF:FFFF:FFFF:FFFF:.. seealso:: :meth:`setNetmask()<PySide2.QtNetwork.QNetworkAddressEntry.setNetmask>` :meth:`prefixLength()<PySide2.QtNetwork.QNetworkAddressEntry.prefixLength>`
-
PySide2.QtNetwork.QNetworkAddressEntry.
__ne__
(other)¶ - Parameters
other –
QNetworkAddressEntry
- Return type
bool
Returns
true
if this network address entry is different fromother
.
-
PySide2.QtNetwork.QNetworkAddressEntry.
__eq__
(other)¶ - Parameters
other –
QNetworkAddressEntry
- Return type
bool
Returns
true
if this network address entry is the same asother
.
-
PySide2.QtNetwork.QNetworkAddressEntry.
prefixLength
()¶ - Return type
int
Returns the prefix length of this IP address. The prefix length matches the number of bits set to 1 in the netmask (see
netmask()
). For IPv4 addresses, the value is between 0 and 32. For IPv6 addresses, it’s contained between 0 and 128 and is the preferred form of representing addresses.This function returns -1 if the prefix length could not be determined (i.e.,
netmask()
returns a null QHostAddress()).See also
-
PySide2.QtNetwork.QNetworkAddressEntry.
setBroadcast
(newBroadcast)¶ - Parameters
newBroadcast –
QHostAddress
Sets the broadcast IP address of this
QNetworkAddressEntry
object tonewBroadcast
.See also
-
PySide2.QtNetwork.QNetworkAddressEntry.
setDnsEligibility
(status)¶ - Parameters
status –
DnsEligibilityStatus
Sets the DNS eligibility flag for this address to
status
.See also
-
PySide2.QtNetwork.QNetworkAddressEntry.
setIp
(newIp)¶ - Parameters
newIp –
QHostAddress
Sets the IP address the
QNetworkAddressEntry
object contains tonewIp
.See also
-
PySide2.QtNetwork.QNetworkAddressEntry.
setNetmask
(newNetmask)¶ - Parameters
newNetmask –
QHostAddress
Sets the netmask that this
QNetworkAddressEntry
object contains tonewNetmask
. Setting the netmask also sets the prefix length to match the new netmask.See also
-
PySide2.QtNetwork.QNetworkAddressEntry.
setPrefixLength
(length)¶ - Parameters
length –
int
Sets the prefix length of this IP address to
length
. The value oflength
must be valid for this type of IP address: between 0 and 32 for IPv4 addresses, between 0 and 128 for IPv6 addresses. Setting to any invalid value is equivalent to setting to -1, which means “no prefix length”.Setting the prefix length also sets the netmask (see
netmask()
).See also
-
PySide2.QtNetwork.QNetworkAddressEntry.
swap
(other)¶ - Parameters
other –
QNetworkAddressEntry
Swaps this network address entry instance with
other
. This function is very fast and never fails.