• PySide 模块
  • PySide.QtNetwork
  • 内容表

    上一话题

    QNetworkCacheMetaData

    下一话题

    QNetworkAddressEntry

    QNetworkInterface

    详细描述

    PySide.QtNetwork.QNetworkInterface class provides a listing of the host's IP addresses and network interfaces.

    PySide.QtNetwork.QNetworkInterface represents one network interface attached to the host where the program is being run. Each network interface may contain zero or more IP addresses, each of which is optionally associated with a netmask and/or a broadcast address. The list of such trios can be obtained with PySide.QtNetwork.QNetworkInterface.addressEntries() . Alternatively, when the netmask or the broadcast addresses aren't necessary, use the PySide.QtNetwork.QNetworkInterface.allAddresses() convenience function to obtain just the IP addresses.

    PySide.QtNetwork.QNetworkInterface also reports the interface's hardware address with PySide.QtNetwork.QNetworkInterface.hardwareAddress() .

    Not all operating systems support reporting all features. Only the IPv4 addresses are guaranteed to be listed by this class in all platforms. In particular, IPv6 address listing is only supported on Windows XP and more recent versions, Linux, MacOS X and the BSDs.

    class PySide.QtNetwork. QNetworkInterface
    class PySide.QtNetwork. QNetworkInterface ( other )
    参数: other PySide.QtNetwork.QNetworkInterface

    构造空的网络接口对象。

    创建副本为 PySide.QtNetwork.QNetworkInterface object contained in other .

    PySide.QtNetwork.QNetworkInterface. InterfaceFlag

    指定关联此网络接口的标志。可能的值:

    常量 描述
    QNetworkInterface.IsUp 网络接口是活动的
    QNetworkInterface.IsRunning the network interface has resources allocated
    QNetworkInterface.CanBroadcast the network interface works in broadcast mode
    QNetworkInterface.IsLoopBack the network interface is a loopback interface: that is, it's a virtual interface whose destination is the host computer itself
    QNetworkInterface.IsPointToPoint the network interface is a point-to-point interface: that is, there is one, single other address that can be directly reached by it.
    QNetworkInterface.CanMulticast the network interface supports multicasting

    Note that one network interface cannot be both broadcast-based and point-to-point.

    PySide.QtNetwork.QNetworkInterface. addressEntries ( )
    返回类型:

    Returns the list of IP addresses that this interface possesses along with their associated netmasks and broadcast addresses.

    If the netmask or broadcast address information is not necessary, you can call the PySide.QtNetwork.QNetworkInterface.allAddresses() function to obtain just the IP addresses.

    static PySide.QtNetwork.QNetworkInterface. allAddresses ( )
    返回类型:

    This convenience function returns all IP addresses found on the host machine. It is equivalent to calling PySide.QtNetwork.QNetworkInterface.addressEntries() on all the objects returned by PySide.QtNetwork.QNetworkInterface.allInterfaces() to obtain lists of PySide.QtNetwork.QHostAddress objects then calling QHostAddress::ip() on each of these.

    static PySide.QtNetwork.QNetworkInterface. allInterfaces ( )
    返回类型:

    Returns a listing of all the network interfaces found on the host machine.

    PySide.QtNetwork.QNetworkInterface. flags ( )
    返回类型: PySide.QtNetwork.QNetworkInterface.InterfaceFlags

    Returns the flags associated with this network interface.

    PySide.QtNetwork.QNetworkInterface. hardwareAddress ( )
    返回类型: unicode

    Returns the low-level hardware address for this interface. On Ethernet interfaces, this will be a MAC address in string representation, separated by colons.

    Other interface types may have other types of hardware addresses. Implementations should not depend on this function returning a valid MAC address.

    PySide.QtNetwork.QNetworkInterface. humanReadableName ( )
    返回类型: unicode

    Returns the human-readable name of this network interface on Windows, such as “Local Area Connection”, if the name could be determined. If it couldn't, this function returns the same as PySide.QtNetwork.QNetworkInterface.name() . The human-readable name is a name that the user can modify in the Windows Control Panel, so it may change during the execution of the program.

    On Unix, this function currently always returns the same as PySide.QtNetwork.QNetworkInterface.name() , since Unix systems don't store a configuration for human-readable names.

    PySide.QtNetwork.QNetworkInterface. index ( )
    返回类型: PySide.QtCore.int

    Returns the interface system index, if known. This is an integer assigned by the operating system to identify this interface and it generally doesn't change. It matches the scope ID field in IPv6 addresses.

    此函数返回 0,若索引未知。

    static PySide.QtNetwork.QNetworkInterface. interfaceFromIndex ( index )
    参数: index PySide.QtCore.int
    返回类型: PySide.QtNetwork.QNetworkInterface

    返回 PySide.QtNetwork.QNetworkInterface object for the interface whose internal ID is index . Network interfaces have a unique identifier called the “interface index” to distinguish it from other interfaces on the system. Often, this value is assigned progressively and interfaces being removed and then added again get a different value every time.

    This index is also found in the IPv6 address' scope ID field.

    static PySide.QtNetwork.QNetworkInterface. interfaceFromName ( name )
    参数: name – unicode
    返回类型: PySide.QtNetwork.QNetworkInterface

    返回 PySide.QtNetwork.QNetworkInterface object for the interface named name . If no such interface exists, this function returns an invalid PySide.QtNetwork.QNetworkInterface 对象。

    PySide.QtNetwork.QNetworkInterface. isValid ( )
    返回类型: PySide.QtCore.bool

    返回 true,若此 PySide.QtNetwork.QNetworkInterface object contains valid information about a network interface.

    PySide.QtNetwork.QNetworkInterface. name ( )
    返回类型: unicode

    Returns the name of this network interface. On Unix systems, this is a string containing the type of the interface and optionally a sequence number, such as “eth0”, “lo” or “pcn0”. On Windows, it's an internal ID that cannot be changed by the user.