|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.network.QNetworkInterface
public class QNetworkInterface
The QNetworkInterface class provides a listing of the host's IP addresses and network interfaces.
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 addressEntries. Alternatively, when the netmask or the broadcast addresses aren't necessary, use the allAddresses convenience function to obtain just the IP addresses.
QNetworkInterface also reports the interface's hardware address with 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.
Nested Class Summary | |
---|---|
static class |
QNetworkInterface.InterfaceFlag
Specifies the flags associated with this network interface. |
static class |
QNetworkInterface.InterfaceFlags
This QFlag class provides flags for the int enum. |
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter |
---|
QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I> |
Constructor Summary | |
---|---|
QNetworkInterface()
Constructs an empty network interface object. |
|
QNetworkInterface(QNetworkInterface other)
Creates a copy of the the QNetworkInterface object contained in other. |
Method Summary | |
---|---|
java.util.List<QNetworkAddressEntry> |
addressEntries()
Returns the list of IP addresses that this interface possesses along with their associated netmasks and broadcast addresses. |
static java.util.List<QHostAddress> |
allAddresses()
This convenience function returns all IP addresses found on the host machine. |
static java.util.List<QNetworkInterface> |
allInterfaces()
Returns a listing of all the network interfaces found on the host machine. |
QNetworkInterface.InterfaceFlags |
flags()
Returns the flags associated with this network interface. |
static QNetworkInterface |
fromNativePointer(QNativePointer nativePointer)
This function returns the QNetworkInterface instance pointed to by nativePointer |
java.lang.String |
hardwareAddress()
Returns the low-level hardware address for this interface. |
static QNetworkInterface |
interfaceFromIndex(int index)
Returns a QNetworkInterface object for the interface whose internal ID is index. |
static QNetworkInterface |
interfaceFromName(java.lang.String name)
Returns a QNetworkInterface object for the interface named name. |
boolean |
isValid()
Returns true if this QNetworkInterface object contains valid information about a network interface. |
java.lang.String |
name()
Returns the name of this network interface. |
static QNativePointer |
nativePointerArray(QNetworkInterface[] array)
This function returns a QNativePointer that is pointing to the specified QNetworkInterface array. |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Constructor Detail |
---|
public QNetworkInterface()
Constructs an empty network interface object.
public QNetworkInterface(QNetworkInterface other)
Creates a copy of the the QNetworkInterface object contained in other.
Method Detail |
---|
public final java.util.List<QNetworkAddressEntry> 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 allAddresses function to obtain just the IP addresses.
public final QNetworkInterface.InterfaceFlags flags()
Returns the flags associated with this network interface.
public final java.lang.String hardwareAddress()
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.
public final boolean isValid()
Returns true if this QNetworkInterface object contains valid information about a network interface.
public final java.lang.String name()
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.
public static java.util.List<QHostAddress> allAddresses()
This convenience function returns all IP addresses found on the host machine. It is equivalent to calling addressEntries on all the objects returned by allInterfaces to obtain lists of QHostAddress objects then calling QHostAddress::ip() on each of these.
public static java.util.List<QNetworkInterface> allInterfaces()
Returns a listing of all the network interfaces found on the host machine.
public static QNetworkInterface interfaceFromIndex(int index)
Returns a 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.
public static QNetworkInterface interfaceFromName(java.lang.String name)
Returns a QNetworkInterface object for the interface named name. If no such interface exists, this function returns an invalid QNetworkInterface object.
public static QNetworkInterface fromNativePointer(QNativePointer nativePointer)
nativePointer
- the QNativePointer of which object should be returned.public static QNativePointer nativePointerArray(QNetworkInterface[] array)
array
- the array that the returned pointer will point to.
|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |