<class name="QHostAddress" doc="/** <p>The <a href="QHostAddress.html#QHostAddress(com.trolltech.qt.network.QHostAddress.SpecialAddress)"><tt>QHostAddress</tt></a> class provides an IP address.</p> <p>This class holds an IPv4 or IPv6 address in a platform- and protocol-independent manner.</p> <p><a href="QHostAddress.html#QHostAddress(com.trolltech.qt.network.QHostAddress.SpecialAddress)"><tt>QHostAddress</tt></a> is normally used with the <a href="QTcpSocket.html"><tt>QTcpSocket</tt></a>, <a href="QTcpServer.html"><tt>QTcpServer</tt></a>, and <a href="QUdpSocket.html"><tt>QUdpSocket</tt></a> to connect to a host or to set up a server.</p> <p>A host address is set with <a href="QHostAddress.html#setAddress(java.lang.String)"><tt>setAddress</tt></a>, checked for its type using isIPv4Address() or isIPv6Address(), and retrieved with <a href="QHostAddress.html#toIPv4Address()"><tt>toIPv4Address</tt></a>, <a href="QHostAddress.html#toIPv6Address()"><tt>toIPv6Address</tt></a>, or <a href="QHostAddress.html#toString()"><tt>toString</tt></a>.</p> <p>The class also supports common predefined addresses: <a href="QHostAddress.html#SpecialAddress-enum">Null</tt></a>, <a href="QHostAddress.html#SpecialAddress-enum"><tt>LocalHost</tt></a>, <a href="QHostAddress.html#SpecialAddress-enum"><tt>LocalHostIPv6</tt></a>, <a href="QHostAddress.html#SpecialAddress-enum">Broadcast</tt></a>, and <a href="QHostAddress.html#SpecialAddress-enum">Any</tt></a>.</p> @see <a href="QTcpSocket.html"><tt>QTcpSocket</tt></a> @see <a href="QTcpServer.html"><tt>QTcpServer</tt></a> @see <a href="QUdpSocket.html"><tt>QUdpSocket</tt></a> */"> <method name="public QHostAddress(java.lang.String address)" doc="/** <p>Constructs an IPv4 or IPv6 address based on the string <tt>address</tt> (e.g&#x2e;, &quot;127.0&#x2e;0&#x2e;1&quot;).</p> @see <a href="QHostAddress.html#setAddress(java.lang.String)"><tt>setAddress</tt></a> */"/> <method name="public QHostAddress(com.trolltech.qt.network.QHostAddress copy)" doc="/** <p>Constructs a copy of the given <tt>copy</tt>.</p> */"/> <method name="public QHostAddress()" doc="/** <p>Constructs a host address object with the IP address 0.0&#x2e;0&#x2e;0&#x2e;</p> @see <a href="QHostAddress.html#clear()"><tt>clear</tt></a> */"/> <method name="public QHostAddress(int ip4Addr)" doc="/** <p>Constructs a host address object with the IPv4 address <tt>ip4Addr</tt>.</p> */"/> <method name="public QHostAddress(com.trolltech.qt.network.QIPv6Address ip6Addr)"/> <method name="public QHostAddress(com.trolltech.qt.network.QHostAddress.SpecialAddress address)" doc="/** <p>Constructs a <a href="QHostAddress.html#QHostAddress(com.trolltech.qt.network.QHostAddress.SpecialAddress)"><tt>QHostAddress</tt></a> object for <tt>address</tt>.</p> */"/> <method name="public final void clear()" doc="/** <p>Sets the host address to 0.0&#x2e;0&#x2e;0&#x2e;</p> */"/> <method name="public final boolean isNull()" doc="/** <p>Returns true if this host address is null (INADDR_ANY or in6addr_any). The default constructor creates a null address, and that address is not valid for any host or interface.</p> */"/> <method name="public final void writeTo(com.trolltech.qt.core.QDataStream arg__1)"/> <method name="public final void readFrom(com.trolltech.qt.core.QDataStream arg__1)"/> <method name="public final com.trolltech.qt.network.QAbstractSocket.NetworkLayerProtocol protocol()" doc="/** <p>Returns the network layer protocol of the host address.</p> */"/> <method name="public final java.lang.String scopeId()" doc="/** <p>Returns the scope ID of an IPv6 address. For IPv4 addresses, or if the address does not contain a scope ID, an empty <a href="%2E%2E/porting4.html#qstring"><tt>QString</tt></a> is returned.</p> <p>The IPv6 scope ID specifies the scope of <i>reachability</i> 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.</p> <p>IPv6 specifies the following four levels of reachability:</p> <ul> <li>Node-local: Addresses that are only used for communicating with services on the same interface (e.g&#x2e;, the loopback interface &quot;<a href="%2E%2E/atomic-operations.html#1">::1</tt></a>&quot;).</li> <li>Link-local: Addresses that are local to the network interface (<i>link</i>). There is always one link-local address for each IPv6 interface on your host. Link-local addresses (&quot;fe80..&#x2e;&quot;) are generated from the MAC address of the local network adaptor, and are not guaranteed to be unique.</li> <li>Site-local: Addresses that are local to the site / private network (e.g&#x2e;, the company intranet). Site-local addresses (&quot;fec0..&#x2e;&quot;) are usually distributed by the site router, and are not guaranteed to be unique outside of the local site.</li> <li>Global: For globally routable addresses, such as public servers on the Internet.</li> </ul> <p>When using a link-local or site-local address for IPv6 connections, you must specify the scope ID. The scope ID for a link-local address is usually the same as the interface name (e.g&#x2e;, &quot;eth0&quot;, &quot;en1&quot;) or number (e.g&#x2e;, &quot;1&quot;, &quot;2&quot;).</p> @see <a href="QHostAddress.html#setScopeId(java.lang.String)"><tt>setScopeId</tt></a> */"/> <method name="public final void setAddress(int ip4Addr)" doc="/** <p>Set the IPv4 address specified by <tt>ip4Addr</tt>.</p> */"/> <method name="public final boolean setAddress(java.lang.String address)" doc="/** <p>Sets the IPv4 or IPv6 address specified by the string representation specified by <tt>address</tt> (e.g&#x2e; &quot;127.0&#x2e;0&#x2e;1&quot;). Returns true and sets the address if the address was successfully parsed; otherwise returns false.</p> */"/> <method name="public final void setAddress(com.trolltech.qt.network.QIPv6Address ip6Addr)"/> <method name="public final void setScopeId(java.lang.String id)" doc="/** <p>Sets the IPv6 scope ID of the address to <tt>id</tt>. If the address protocol is not IPv6, this function does nothing.</p> @see <a href="QHostAddress.html#scopeId()"><tt>scopeId</tt></a> */"/> <method name="public final int toIPv4Address()" doc="/** <p>Returns the IPv4 address as a number.</p> <p>For example, if the address is 127.0&#x2e;0&#x2e;1, the returned value is 2130706433 (i.e&#x2e; 0x7f000001).</p> <p>This value is only valid if isIp4Addr() returns true.</p> @see <a href="QHostAddress.html#toString()"><tt>toString</tt></a> */"/> <method name="public final com.trolltech.qt.network.QIPv6Address toIPv6Address()" doc="/** <p>Returns the IPv6 address as a Q_IPV6ADDR structure. The structure consists of 16 unsigned characters.</p> <pre> Q_IPV6ADDR addr = hostAddr.toIPv6Address(); <span class="comment"> // addr contains 16 unsigned characters</span> for (int i = 0; i &lt; 16; ++i) { <span class="comment">// process addr[i]</span> }</pre> <p>This value is only valid if isIPv6Address() returns true.</p> @see <a href="QHostAddress.html#toString()"><tt>toString</tt></a> */"/> <method name="public final java.lang.String toString()" doc="/** <p>Returns the address as a string.</p> <p>For example, if the address is the IPv4 address 127.0&#x2e;0&#x2e;1, the returned string is &quot;127.0&#x2e;0&#x2e;1&quot;.</p> @see <a href="QHostAddress.html#toIPv4Address()"><tt>toIPv4Address</tt></a> */"/> <enum name="SpecialAddress"> <enum-value name="Null" doc="/** <p>The null address object. Equivalent to <a href="QHostAddress.html#QHostAddress(com.trolltech.qt.network.QHostAddress.SpecialAddress)"><tt>QHostAddress</tt></a>.</p> */"/> <enum-value name="Broadcast" doc="/** <p>The IPv4 broadcast address. Equivalent to <a href="QHostAddress.html#QHostAddress(com.trolltech.qt.network.QHostAddress.SpecialAddress)"><tt>QHostAddress</tt></a>(&quot;255.255.255.255&quot;).</p> */"/> <enum-value name="LocalHost" doc="/** <p>The IPv4 localhost address. Equivalent to <a href="QHostAddress.html#QHostAddress(com.trolltech.qt.network.QHostAddress.SpecialAddress)"><tt>QHostAddress</tt></a>(&quot;127.0&#x2e;0&#x2e;1&quot;).</p> */"/> <enum-value name="LocalHostIPv6" doc="/** <p>The IPv6 localhost address. Equivalent to <a href="QHostAddress.html#QHostAddress(com.trolltech.qt.network.QHostAddress.SpecialAddress)"><tt>QHostAddress</tt></a>(&quot;<a href="%2E%2E/atomic-operations.html#1">::1</tt></a>&quot;).</p> */"/> <enum-value name="Any" doc="/** <p>The IPv4 any-address. Equivalent to <a href="QHostAddress.html#QHostAddress(com.trolltech.qt.network.QHostAddress.SpecialAddress)"><tt>QHostAddress</tt></a>(&quot;0.0&#x2e;0&#x2e;0&quot;).</p> */"/> <enum-value name="AnyIPv6" doc="/** <p>The IPv6 any-address. Equivalent to <a href="QHostAddress.html#QHostAddress(com.trolltech.qt.network.QHostAddress.SpecialAddress)"><tt>QHostAddress</tt></a>(&quot;::&quot;).</p> */"/> </enum> </class>