|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.network.QHostAddress
public class QHostAddress
The QHostAddress class provides an IP address. This class holds an IPv4 or IPv6 address in a platform- and protocol-independent manner.
QHostAddress is normally used with the QTcpSocket
, QTcpServer
, and QUdpSocket
to connect to a host or to set up a server.
A host address is set with setAddress()
, checked for its type using isIPv4Address() or isIPv6Address(), and retrieved with toIPv4Address()
, toIPv6Address()
, or toString()
.
The class also supports common predefined addresses: Null
, LocalHost
, LocalHostIPv6
, Broadcast
, and Any
.
QTcpSocket
, QTcpServer
, and QUdpSocket
.
Nested Class Summary | |
---|---|
static class |
QHostAddress.SpecialAddress
|
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter |
---|
QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9 |
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal |
Field Summary |
---|
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
currentSender |
Constructor Summary | |
---|---|
QHostAddress()
Constructs a host address object with the IP address 0. |
|
QHostAddress(int ip4Addr)
Constructs a host address object with the IPv4 address ip4Addr. |
|
QHostAddress(QHostAddress.SpecialAddress address)
Constructs a QHostAddress object for address. |
|
QHostAddress(QHostAddress copy)
Constructs a copy of the given address. |
|
QHostAddress(QIPv6Address ip6Addr)
Creates a QHostAddress from the specified ip6Addr address. |
|
QHostAddress(java.lang.String address)
Constructs an IPv4 or IPv6 address based on the string address (e. |
Method Summary | |
---|---|
void |
clear()
Sets the host address to 0.0.0.0. |
QHostAddress |
clone()
This method is reimplemented for internal reasons |
boolean |
isNull()
Returns true if this host address is null (INADDR_ANY or in6addr_any). |
QAbstractSocket.NetworkLayerProtocol |
protocol()
Returns the network layer protocol of the host address. |
void |
readFrom(QDataStream arg__1)
|
java.lang.String |
scopeId()
Returns the scope ID of an IPv6 address. |
void |
setAddress(int ip4Addr)
Set the IPv4 address specified by ip4Addr. |
void |
setAddress(QIPv6Address ip6Addr)
Sets the address of this QHostAddress to ip6Addr. |
boolean |
setAddress(java.lang.String address)
Sets the IPv4 or IPv6 address specified by the string representation specified by address (e.g. |
void |
setScopeId(java.lang.String id)
Sets the IPv6 scope ID of the address to id. |
int |
toIPv4Address()
Returns the IPv4 address as a number. |
QIPv6Address |
toIPv6Address()
Returns the IPv6 address as a Q_IPV6ADDR structure. |
java.lang.String |
toString()
|
void |
writeTo(QDataStream arg__1)
|
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread |
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
__qt_signalInitialization |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Constructor Detail |
---|
public QHostAddress()
clear()
.
public QHostAddress(QHostAddress.SpecialAddress address)
public QHostAddress(QHostAddress copy)
public QHostAddress(QIPv6Address ip6Addr)
public QHostAddress(java.lang.String address)
setAddress()
.
public QHostAddress(int ip4Addr)
Method Detail |
---|
public final void clear()
public final boolean isNull()
public final void writeTo(QDataStream arg__1)
public final void readFrom(QDataStream arg__1)
public final QAbstractSocket.NetworkLayerProtocol protocol()
public final java.lang.String scopeId()
The IPv6 scope ID specifies the scope of reachability for non-global IPv6 addresses, limiting the area in which the address can be used. All IPv6 addresses are associated with such a reachability scope. The scope ID is used to disambiguate addresses that are not guaranteed to be globally unique.
IPv6 specifies the following four levels of reachability:
setScopeId()
.
public final void setAddress(QIPv6Address ip6Addr)
public final boolean setAddress(java.lang.String address)
public final void setAddress(int ip4Addr)
public final void setScopeId(java.lang.String id)
scopeId()
.
public final int toIPv4Address()
For example, if the address is 127.0.0.1, the returned value is 2130706433 (i.e. 0x7f000001).
This value is only valid if isIp4Addr() returns true.
toString()
.
public final QIPv6Address toIPv6Address()
QIPv6Address addr = hostAddr.toIPv6Address(); // addr contains 16 unsigned characters for (int i = 0; i < 16; ++i) { // process addr.c[i] }This value is only valid if isIPv6Address() returns true.
toString()
.
public final java.lang.String toString()
toString
in class java.lang.Object
public QHostAddress clone()
clone
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |