Sophie

Sophie

distrib > Fedora > 18 > x86_64 > by-pkgid > ff187cb994c94c614ecc64c5a8528b1b > files > 5520

qt-doc-4.8.5-10.fc18.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qhostaddress.cpp -->
  <title>Qt 4.8: QHostAddress Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->

<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>

</head>
<body class="" onload="CheckEmptyAndLoadList();">
 <div class="header" id="qtdocheader">
    <div class="content"> 
    <div id="nav-logo">
      <a href="index.html">Home</a></div>
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
    <div id="narrowsearch"></div>
    <div id="nav-topright">
      <ul>
        <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
        <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
        <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
          DOC</a></li>
        <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
      </ul>
    </div>
    <div id="shortCut">
      <ul>
        <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
        <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS        </a></li>
      </ul>
     </div>
 <ul class="sf-menu" id="narrowmenu"> 
             <li><a href="#">API Lookup</a> 
                 <ul> 
                     <li><a href="classes.html">Class index</a></li> 
           <li><a href="functions.html">Function index</a></li> 
           <li><a href="modules.html">Modules</a></li> 
           <li><a href="namespaces.html">Namespaces</a></li> 
           <li><a href="qtglobal.html">Global Declarations</a></li> 
           <li><a href="qdeclarativeelements.html">QML elements</a></li> 
             </ul> 
             </li> 
             <li><a href="#">Qt Topics</a> 
                 <ul> 
                        <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>  
                        <li><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>  
                        <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>  
                        <li><a href="supported-platforms.html">Supported Platforms</a></li>  
                        <li><a href="technology-apis.html">Qt and Key Technologies</a></li>  
                        <li><a href="best-practices.html">How-To's and Best Practices</a></li>  
              </ul> 
                 </li> 
                 <li><a href="#">Examples</a> 
                     <ul> 
                       <li><a href="all-examples.html">Examples</a></li> 
                       <li><a href="tutorials.html">Tutorials</a></li> 
                       <li><a href="demos.html">Demos</a></li> 
                       <li><a href="qdeclarativeexamples.html">QML Examples</a></li> 
                </ul> 
                     </li> 
                 </ul> 
    </div>
  </div>
  <div class="wrapper">
    <div class="hd">
      <span></span>
    </div>
    <div class="bd group">
      <div class="sidebar">
        <div class="searchlabel">
          Search index:</div>
        <div class="search" id="sidebarsearch">
          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />
 <div id="resultdialog"> 
 <a href="#" id="resultclose">Close</a> 
 <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> 
 <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span>&nbsp;results:</p> 
 <ul id="resultlist" class="all"> 
 </ul> 
 </div> 
            </fieldset>
          </form>
        </div>
        <div class="box first bottombar" id="lookup">
          <h2 title="API Lookup"><span></span>
            API Lookup</h2>
          <div  id="list001" class="list">
          <ul id="ul001" >
              <li class="defaultLink"><a href="classes.html">Class index</a></li>
              <li class="defaultLink"><a href="functions.html">Function index</a></li>
              <li class="defaultLink"><a href="modules.html">Modules</a></li>
              <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
              <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
              <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
            </ul> 
          </div>
        </div>
        <div class="box bottombar" id="topics">
          <h2 title="Qt Topics"><span></span>
            Qt Topics</h2>
          <div id="list002" class="list">
            <ul id="ul002" >
               <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> 
               <li class="defaultLink"><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li> 
               <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> 
               <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>  
               <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> 
               <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> 
            </ul>  
          </div>
        </div>
        <div class="box" id="examples">
          <h2 title="Examples"><span></span>
            Examples</h2>
          <div id="list003" class="list">
        <ul id="ul003">
              <li class="defaultLink"><a href="all-examples.html">Examples</a></li>
              <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
              <li class="defaultLink"><a href="demos.html">Demos</a></li>
              <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
            </ul> 
          </div>
        </div>
      </div>
      <div class="wrap">
        <div class="toolbar">
          <div class="breadcrumb toolblock">
            <ul>
              <li class="first"><a href="index.html">Home</a></li>
              <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtnetwork.html">QtNetwork</a></li>
<li>QHostAddress</li>
            </ul>
          </div>
          <div class="toolbuttons toolblock">
            <ul>
              <li id="smallA" class="t_button">A</li>
              <li id="medA" class="t_button active">A</li>
              <li id="bigA" class="t_button">A</li>
              <li id="print" class="t_button"><a href="javascript:this.print();">
                <span>Print</span></a></li>
            </ul>
        </div>
        </div>
        <div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#related-non-members">Related Non-Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QHostAddress Class Reference</h1>
<!-- $$$QHostAddress-brief -->
<p>The QHostAddress class provides an IP address. <a href="#details">More...</a></p>
<!-- @@@QHostAddress -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QHostAddress&gt;</span></pre><ul>
<li><a href="qhostaddress-members.html">List of all members, including inherited members</a></li>
<li><a href="qhostaddress-qt3.html">Qt 3 support members</a></li>
</ul>
<a name="public-types"></a>
<h2>Public Types</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#SpecialAddress-enum">SpecialAddress</a></b> { Null, LocalHost, LocalHostIPv6, Broadcast, Any, AnyIPv6 }</td></tr>
</table>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#QHostAddress">QHostAddress</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#QHostAddress-2">QHostAddress</a></b> ( quint32 <i>ip4Addr</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#QHostAddress-3">QHostAddress</a></b> ( quint8 * <i>ip6Addr</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#QHostAddress-4">QHostAddress</a></b> ( const Q_IPV6ADDR &amp; <i>ip6Addr</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#QHostAddress-5">QHostAddress</a></b> ( const sockaddr * <i>sockaddr</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#QHostAddress-6">QHostAddress</a></b> ( const QString &amp; <i>address</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#QHostAddress-7">QHostAddress</a></b> ( const QHostAddress &amp; <i>address</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#QHostAddress-8">QHostAddress</a></b> ( SpecialAddress <i>address</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#dtor.QHostAddress">~QHostAddress</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#clear">clear</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#isInSubnet">isInSubnet</a></b> ( const QHostAddress &amp; <i>subnet</i>, int <i>netmask</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#isInSubnet-2">isInSubnet</a></b> ( const QPair&lt;QHostAddress, int&gt; &amp; <i>subnet</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#isNull">isNull</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAbstractSocket::NetworkLayerProtocol </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#protocol">protocol</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#scopeId">scopeId</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#setAddress">setAddress</a></b> ( quint32 <i>ip4Addr</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#setAddress-2">setAddress</a></b> ( quint8 * <i>ip6Addr</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#setAddress-3">setAddress</a></b> ( const Q_IPV6ADDR &amp; <i>ip6Addr</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#setAddress-4">setAddress</a></b> ( const QString &amp; <i>address</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#setAddress-5">setAddress</a></b> ( const sockaddr * <i>sockaddr</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#setScopeId">setScopeId</a></b> ( const QString &amp; <i>id</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> quint32 </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#toIPv4Address">toIPv4Address</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Q_IPV6ADDR </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#toIPv6Address">toIPv6Address</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#toString">toString</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#operator-not-eq">operator!=</a></b> ( const QHostAddress &amp; <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#operator-not-eq-2">operator!=</a></b> ( SpecialAddress <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QHostAddress &amp; </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#operator-eq">operator=</a></b> ( const QHostAddress &amp; <i>address</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QHostAddress &amp; </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#operator-eq-2">operator=</a></b> ( const QString &amp; <i>address</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#operator-eq-eq">operator==</a></b> ( const QHostAddress &amp; <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#operator-eq-eq-2">operator==</a></b> ( SpecialAddress <i>other</i> ) const</td></tr>
</table>
<a name="static-public-members"></a>
<h2>Static Public Members</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> QPair&lt;QHostAddress, int&gt; </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#parseSubnet">parseSubnet</a></b> ( const QString &amp; <i>subnet</i> )</td></tr>
</table>
<a name="related-non-members"></a>
<h2>Related Non-Members</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> QDataStream &amp; </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#operator-lt-lt-167">operator&lt;&lt;</a></b> ( QDataStream &amp; <i>out</i>, const QHostAddress &amp; <i>address</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDataStream &amp; </td><td class="memItemRight bottomAlign"><b><a href="qhostaddress.html#operator-gt-gt-98">operator&gt;&gt;</a></b> ( QDataStream &amp; <i>in</i>, QHostAddress &amp; <i>address</i> )</td></tr>
</table>
<a name="details"></a>
<!-- $$$QHostAddress-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QHostAddress class provides an IP address.</p>
<p>This class holds an IPv4 or IPv6 address in a platform- and protocol-independent manner.</p>
<p>QHostAddress is normally used with the <a href="qtcpsocket.html">QTcpSocket</a>, <a href="qtcpserver.html">QTcpServer</a>, and <a href="qudpsocket.html">QUdpSocket</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">setAddress</a>(), and retrieved with <a href="qhostaddress.html#toIPv4Address">toIPv4Address</a>(), <a href="qhostaddress.html#toIPv6Address">toIPv6Address</a>(), or <a href="qhostaddress.html#toString">toString</a>(). You can check the type with <a href="qhostaddress.html#protocol">protocol</a>().</p>
<p><b>Note:</b> Please note that QHostAddress does not do DNS lookups. <a href="qhostinfo.html">QHostInfo</a> is needed for that.</p>
<p>The class also supports common predefined addresses: <a href="qhostaddress.html#SpecialAddress-enum">Null</a>, <a href="qhostaddress.html#SpecialAddress-enum">LocalHost</a>, <a href="qhostaddress.html#SpecialAddress-enum">LocalHostIPv6</a>, <a href="qhostaddress.html#SpecialAddress-enum">Broadcast</a>, and <a href="qhostaddress.html#SpecialAddress-enum">Any</a>.</p>
</div>
<p><b>See also </b><a href="qhostinfo.html">QHostInfo</a>, <a href="qtcpsocket.html">QTcpSocket</a>, <a href="qtcpserver.html">QTcpServer</a>, and <a href="qudpsocket.html">QUdpSocket</a>.</p>
<!-- @@@QHostAddress -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$SpecialAddress$$$Null$$$Broadcast$$$LocalHost$$$LocalHostIPv6$$$Any$$$AnyIPv6 -->
<h3 class="fn"><a name="SpecialAddress-enum"></a>enum QHostAddress::<span class="name">SpecialAddress</span></h3>
<table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><tt>QHostAddress::Null</tt></td><td class="topAlign"><tt>0</tt></td><td class="topAlign">The null address object. Equivalent to <a href="qhostaddress.html#QHostAddress">QHostAddress</a>().</td></tr>
<tr><td class="topAlign"><tt>QHostAddress::LocalHost</tt></td><td class="topAlign"><tt>2</tt></td><td class="topAlign">The IPv4 localhost address. Equivalent to <a href="qhostaddress.html">QHostAddress</a>(&quot;127.0&#x2e;0&#x2e;1&quot;).</td></tr>
<tr><td class="topAlign"><tt>QHostAddress::LocalHostIPv6</tt></td><td class="topAlign"><tt>3</tt></td><td class="topAlign">The IPv6 localhost address. Equivalent to <a href="qhostaddress.html">QHostAddress</a>(&quot;::1&quot;).</td></tr>
<tr><td class="topAlign"><tt>QHostAddress::Broadcast</tt></td><td class="topAlign"><tt>1</tt></td><td class="topAlign">The IPv4 broadcast address. Equivalent to <a href="qhostaddress.html">QHostAddress</a>(&quot;255.255.255.255&quot;).</td></tr>
<tr><td class="topAlign"><tt>QHostAddress::Any</tt></td><td class="topAlign"><tt>4</tt></td><td class="topAlign">The IPv4 any-address. Equivalent to <a href="qhostaddress.html">QHostAddress</a>(&quot;0.0&#x2e;0&#x2e;0&quot;).</td></tr>
<tr><td class="topAlign"><tt>QHostAddress::AnyIPv6</tt></td><td class="topAlign"><tt>5</tt></td><td class="topAlign">The IPv6 any-address. Equivalent to <a href="qhostaddress.html">QHostAddress</a>(&quot;<a href="index.html">::</a>&quot;).</td></tr>
</table>
<!-- @@@SpecialAddress -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QHostAddress[overload1]$$$QHostAddress -->
<h3 class="fn"><a name="QHostAddress"></a>QHostAddress::<span class="name">QHostAddress</span> ()</h3>
<p>Constructs a host address object with the IP address 0.0&#x2e;0&#x2e;0&#x2e;</p>
<p><b>See also </b><a href="qhostaddress.html#clear">clear</a>().</p>
<!-- @@@QHostAddress -->
<!-- $$$QHostAddress$$$QHostAddressquint32 -->
<h3 class="fn"><a name="QHostAddress-2"></a>QHostAddress::<span class="name">QHostAddress</span> ( <span class="type"><a href="qtglobal.html#quint32-typedef">quint32</a></span> <i>ip4Addr</i> )</h3>
<p>Constructs a host address object with the IPv4 address <i>ip4Addr</i>.</p>
<!-- @@@QHostAddress -->
<!-- $$$QHostAddress$$$QHostAddressquint8* -->
<h3 class="fn"><a name="QHostAddress-3"></a>QHostAddress::<span class="name">QHostAddress</span> ( <span class="type"><a href="qtglobal.html#quint8-typedef">quint8</a></span> * <i>ip6Addr</i> )</h3>
<p>Constructs a host address object with the IPv6 address <i>ip6Addr</i>.</p>
<p><i>ip6Addr</i> must be a 16-byte array in network byte order (big endian).</p>
<!-- @@@QHostAddress -->
<!-- $$$QHostAddress$$$QHostAddressconstQ_IPV6ADDR& -->
<h3 class="fn"><a name="QHostAddress-4"></a>QHostAddress::<span class="name">QHostAddress</span> ( const <span class="type">Q_IPV6ADDR</span> &amp; <i>ip6Addr</i> )</h3>
<p>Constructs a host address object with the IPv6 address <i>ip6Addr</i>.</p>
<!-- @@@QHostAddress -->
<!-- $$$QHostAddress$$$QHostAddressconstsockaddr* -->
<h3 class="fn"><a name="QHostAddress-5"></a>QHostAddress::<span class="name">QHostAddress</span> ( const <span class="type">sockaddr</span> * <i>sockaddr</i> )</h3>
<p>Constructs an IPv4 or IPv6 address using the address specified by the native structure <i>sockaddr</i>.</p>
<p><b>See also </b><a href="qhostaddress.html#setAddress">setAddress</a>().</p>
<!-- @@@QHostAddress -->
<!-- $$$QHostAddress$$$QHostAddressconstQString& -->
<h3 class="fn"><a name="QHostAddress-6"></a>QHostAddress::<span class="name">QHostAddress</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>address</i> )</h3>
<p>Constructs an IPv4 or IPv6 address based on the string <i>address</i> (e.g&#x2e;, &quot;127.0&#x2e;0&#x2e;1&quot;).</p>
<p><b>See also </b><a href="qhostaddress.html#setAddress">setAddress</a>().</p>
<!-- @@@QHostAddress -->
<!-- $$$QHostAddress$$$QHostAddressconstQHostAddress& -->
<h3 class="fn"><a name="QHostAddress-7"></a>QHostAddress::<span class="name">QHostAddress</span> ( const <span class="type">QHostAddress</span> &amp; <i>address</i> )</h3>
<p>Constructs a copy of the given <i>address</i>.</p>
<!-- @@@QHostAddress -->
<!-- $$$QHostAddress$$$QHostAddressSpecialAddress -->
<h3 class="fn"><a name="QHostAddress-8"></a>QHostAddress::<span class="name">QHostAddress</span> ( <span class="type"><a href="qhostaddress.html#SpecialAddress-enum">SpecialAddress</a></span> <i>address</i> )</h3>
<p>Constructs a <a href="qhostaddress.html">QHostAddress</a> object for <i>address</i>.</p>
<!-- @@@QHostAddress -->
<!-- $$$~QHostAddress[overload1]$$$~QHostAddress -->
<h3 class="fn"><a name="dtor.QHostAddress"></a>QHostAddress::<span class="name">~QHostAddress</span> ()</h3>
<p>Destroys the host address object.</p>
<!-- @@@~QHostAddress -->
<!-- $$$clear[overload1]$$$clear -->
<h3 class="fn"><a name="clear"></a><span class="type">void</span> QHostAddress::<span class="name">clear</span> ()</h3>
<p>Sets the host address to 0.0&#x2e;0&#x2e;0&#x2e;</p>
<!-- @@@clear -->
<!-- $$$isInSubnet[overload1]$$$isInSubnetconstQHostAddress&int -->
<h3 class="fn"><a name="isInSubnet"></a><span class="type">bool</span> QHostAddress::<span class="name">isInSubnet</span> ( const <span class="type">QHostAddress</span> &amp; <i>subnet</i>, <span class="type">int</span> <i>netmask</i> ) const</h3>
<p>Returns true if this IP is in the subnet described by the network prefix <i>subnet</i> and netmask <i>netmask</i>.</p>
<p>An IP is considered to belong to a subnet if it is contained between the lowest and the highest address in that subnet. In the case of IP version 4, the lowest address is the network address, while the highest address is the broadcast address.</p>
<p>The <i>subnet</i> argument does not have to be the actual network address (the lowest address in the subnet). It can be any valid IP belonging to that subnet. In particular, if it is equal to the IP address held by this object, this function will always return true (provided the netmask is a valid value).</p>
<p>This function was introduced in Qt 4.5.</p>
<p><b>See also </b><a href="qhostaddress.html#parseSubnet">parseSubnet</a>().</p>
<!-- @@@isInSubnet -->
<!-- $$$isInSubnet$$$isInSubnetconstQPair<QHostAddress,int>& -->
<h3 class="fn"><a name="isInSubnet-2"></a><span class="type">bool</span> QHostAddress::<span class="name">isInSubnet</span> ( const <span class="type"><a href="qpair.html">QPair</a></span>&lt;<span class="type">QHostAddress</span>, <span class="type">int</span>&gt; &amp; <i>subnet</i> ) const</h3>
<p>This is an overloaded function.</p>
<p>Returns true if this IP is in the subnet described by <i>subnet</i>. The <a href="qhostaddress.html">QHostAddress</a> member of <i>subnet</i> contains the network prefix and the int (second) member contains the netmask (prefix length).</p>
<p>This function was introduced in Qt 4.5.</p>
<!-- @@@isInSubnet -->
<!-- $$$isNull[overload1]$$$isNull -->
<h3 class="fn"><a name="isNull"></a><span class="type">bool</span> QHostAddress::<span class="name">isNull</span> () const</h3>
<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>
<!-- @@@isNull -->
<!-- $$$parseSubnet[overload1]$$$parseSubnetconstQString& -->
<h3 class="fn"><a name="parseSubnet"></a><span class="type"><a href="qpair.html">QPair</a></span>&lt;<span class="type">QHostAddress</span>, <span class="type">int</span>&gt; QHostAddress::<span class="name">parseSubnet</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>subnet</i> )<tt> [static]</tt></h3>
<p>Parses the IP and subnet information contained in <i>subnet</i> and returns the network prefix for that network and its prefix length.</p>
<p>The IP address and the netmask must be separated by a slash (/).</p>
<p>This function supports arguments in the form:</p>
<ul>
<li>123.123.123.123/n where n is any value between 0 and 32</li>
<li>123.123.123.123/255.255.255.255</li>
<li>&lt;ipv6-address&gt;/n where n is any value between 0 and 128</li>
</ul>
<p>For IP version 4, this function accepts as well missing trailing components (i.e&#x2e;, less than 4 octets, like &quot;192.168.1&quot;), followed or not by a dot. If the netmask is also missing in that case, it is set to the number of octets actually passed (in the example above, it would be 24, for 3 octets).</p>
<p>This function was introduced in Qt 4.5.</p>
<p><b>See also </b><a href="qhostaddress.html#isInSubnet">isInSubnet</a>().</p>
<!-- @@@parseSubnet -->
<!-- $$$protocol[overload1]$$$protocol -->
<h3 class="fn"><a name="protocol"></a><span class="type"><a href="qabstractsocket.html#NetworkLayerProtocol-enum">QAbstractSocket::NetworkLayerProtocol</a></span> QHostAddress::<span class="name">protocol</span> () const</h3>
<p>Returns the network layer protocol of the host address.</p>
<!-- @@@protocol -->
<!-- $$$scopeId[overload1]$$$scopeId -->
<h3 class="fn"><a name="scopeId"></a><span class="type"><a href="qstring.html">QString</a></span> QHostAddress::<span class="name">scopeId</span> () const</h3>
<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="qstring.html">QString</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;::1&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>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also </b><a href="qhostaddress.html#setScopeId">setScopeId</a>().</p>
<!-- @@@scopeId -->
<!-- $$$setAddress[overload1]$$$setAddressquint32 -->
<h3 class="fn"><a name="setAddress"></a><span class="type">void</span> QHostAddress::<span class="name">setAddress</span> ( <span class="type"><a href="qtglobal.html#quint32-typedef">quint32</a></span> <i>ip4Addr</i> )</h3>
<p>Set the IPv4 address specified by <i>ip4Addr</i>.</p>
<!-- @@@setAddress -->
<!-- $$$setAddress$$$setAddressquint8* -->
<h3 class="fn"><a name="setAddress-2"></a><span class="type">void</span> QHostAddress::<span class="name">setAddress</span> ( <span class="type"><a href="qtglobal.html#quint8-typedef">quint8</a></span> * <i>ip6Addr</i> )</h3>
<p>This is an overloaded function.</p>
<p>Set the IPv6 address specified by <i>ip6Addr</i>.</p>
<p><i>ip6Addr</i> must be an array of 16 bytes in network byte order (high-order byte first).</p>
<!-- @@@setAddress -->
<!-- $$$setAddress$$$setAddressconstQ_IPV6ADDR& -->
<h3 class="fn"><a name="setAddress-3"></a><span class="type">void</span> QHostAddress::<span class="name">setAddress</span> ( const <span class="type">Q_IPV6ADDR</span> &amp; <i>ip6Addr</i> )</h3>
<p>This is an overloaded function.</p>
<p>Set the IPv6 address specified by <i>ip6Addr</i>.</p>
<!-- @@@setAddress -->
<!-- $$$setAddress$$$setAddressconstQString& -->
<h3 class="fn"><a name="setAddress-4"></a><span class="type">bool</span> QHostAddress::<span class="name">setAddress</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>address</i> )</h3>
<p>This is an overloaded function.</p>
<p>Sets the IPv4 or IPv6 address specified by the string representation specified by <i>address</i> (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>
<!-- @@@setAddress -->
<!-- $$$setAddress$$$setAddressconstsockaddr* -->
<h3 class="fn"><a name="setAddress-5"></a><span class="type">void</span> QHostAddress::<span class="name">setAddress</span> ( const <span class="type">sockaddr</span> * <i>sockaddr</i> )</h3>
<p>This is an overloaded function.</p>
<p>Sets the IPv4 or IPv6 address specified by the native structure <i>sockaddr</i>. Returns true and sets the address if the address was successfully parsed; otherwise returns false.</p>
<!-- @@@setAddress -->
<!-- $$$setScopeId[overload1]$$$setScopeIdconstQString& -->
<h3 class="fn"><a name="setScopeId"></a><span class="type">void</span> QHostAddress::<span class="name">setScopeId</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>id</i> )</h3>
<p>Sets the IPv6 scope ID of the address to <i>id</i>. If the address protocol is not IPv6, this function does nothing.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also </b><a href="qhostaddress.html#scopeId">scopeId</a>().</p>
<!-- @@@setScopeId -->
<!-- $$$toIPv4Address[overload1]$$$toIPv4Address -->
<h3 class="fn"><a name="toIPv4Address"></a><span class="type"><a href="qtglobal.html#quint32-typedef">quint32</a></span> QHostAddress::<span class="name">toIPv4Address</span> () const</h3>
<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 the Protocol() is <a href="qabstractsocket.html#NetworkLayerProtocol-enum">IPv4Protocol</a>.</p>
<p><b>See also </b><a href="qhostaddress.html#toString">toString</a>().</p>
<!-- @@@toIPv4Address -->
<!-- $$$toIPv6Address[overload1]$$$toIPv6Address -->
<h3 class="fn"><a name="toIPv6Address"></a><span class="type">Q_IPV6ADDR</span> QHostAddress::<span class="name">toIPv6Address</span> () const</h3>
<p>Returns the IPv6 address as a Q_IPV6ADDR structure. The structure consists of 16 unsigned characters.</p>
<pre class="cpp"> Q_IPV6ADDR addr <span class="operator">=</span> hostAddr<span class="operator">.</span>toIPv6Address();
 <span class="comment">// addr contains 16 unsigned characters</span>

 <span class="keyword">for</span> (<span class="type">int</span> i <span class="operator">=</span> <span class="number">0</span>; i <span class="operator">&lt;</span> <span class="number">16</span>; <span class="operator">+</span><span class="operator">+</span>i) {
     <span class="comment">// process addr[i]</span>
 }</pre>
<p>This value is only valid if the <a href="qhostaddress.html#protocol">protocol</a>() is <a href="qabstractsocket.html#NetworkLayerProtocol-enum">IPv6Protocol</a>.</p>
<p><b>See also </b><a href="qhostaddress.html#toString">toString</a>().</p>
<!-- @@@toIPv6Address -->
<!-- $$$toString[overload1]$$$toString -->
<h3 class="fn"><a name="toString"></a><span class="type"><a href="qstring.html">QString</a></span> QHostAddress::<span class="name">toString</span> () const</h3>
<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;. For IPv6 the string format will follow the RFC5952 recommendation.</p>
<p><b>See also </b><a href="qhostaddress.html#toIPv4Address">toIPv4Address</a>().</p>
<!-- @@@toString -->
<!-- $$$operator!=[overload1]$$$operator!=constQHostAddress& -->
<h3 class="fn"><a name="operator-not-eq"></a><span class="type">bool</span> QHostAddress::<span class="name">operator!=</span> ( const <span class="type">QHostAddress</span> &amp; <i>other</i> ) const</h3>
<p>Returns true if this host address is not the same as the <i>other</i> address given; otherwise returns false.</p>
<p>This function was introduced in Qt 4.2.</p>
<!-- @@@operator!= -->
<!-- $$$operator!=$$$operator!=SpecialAddress -->
<h3 class="fn"><a name="operator-not-eq-2"></a><span class="type">bool</span> QHostAddress::<span class="name">operator!=</span> ( <span class="type"><a href="qhostaddress.html#SpecialAddress-enum">SpecialAddress</a></span> <i>other</i> ) const</h3>
<p>Returns true if this host address is not the same as the <i>other</i> address given; otherwise returns false.</p>
<!-- @@@operator!= -->
<!-- $$$operator=[overload1]$$$operator=constQHostAddress& -->
<h3 class="fn"><a name="operator-eq"></a><span class="type">QHostAddress</span> &amp; QHostAddress::<span class="name">operator=</span> ( const <span class="type">QHostAddress</span> &amp; <i>address</i> )</h3>
<p>Assigns another host <i>address</i> to this object, and returns a reference to this object.</p>
<!-- @@@operator= -->
<!-- $$$operator=$$$operator=constQString& -->
<h3 class="fn"><a name="operator-eq-2"></a><span class="type">QHostAddress</span> &amp; QHostAddress::<span class="name">operator=</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>address</i> )</h3>
<p>Assigns the host address <i>address</i> to this object, and returns a reference to this object.</p>
<p><b>See also </b><a href="qhostaddress.html#setAddress">setAddress</a>().</p>
<!-- @@@operator= -->
<!-- $$$operator==[overload1]$$$operator==constQHostAddress& -->
<h3 class="fn"><a name="operator-eq-eq"></a><span class="type">bool</span> QHostAddress::<span class="name">operator==</span> ( const <span class="type">QHostAddress</span> &amp; <i>other</i> ) const</h3>
<p>Returns true if this host address is the same as the <i>other</i> address given; otherwise returns false.</p>
<!-- @@@operator== -->
<!-- $$$operator==$$$operator==SpecialAddress -->
<h3 class="fn"><a name="operator-eq-eq-2"></a><span class="type">bool</span> QHostAddress::<span class="name">operator==</span> ( <span class="type"><a href="qhostaddress.html#SpecialAddress-enum">SpecialAddress</a></span> <i>other</i> ) const</h3>
<p>Returns true if this host address is the same as the <i>other</i> address given; otherwise returns false.</p>
<!-- @@@operator== -->
</div>
<div class="relnonmem">
<h2>Related Non-Members</h2>
<!-- $$$operator<<$$$operator<<QDataStream&constQHostAddress& -->
<h3 class="fn"><a name="operator-lt-lt-167"></a><span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <span class="name">operator&lt;&lt;</span> ( <span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <i>out</i>, const <span class="type">QHostAddress</span> &amp; <i>address</i> )</h3>
<p>Writes host address <i>address</i> to the stream <i>out</i> and returns a reference to the stream.</p>
<p><b>See also </b><a href="datastreamformat.html">Serializing Qt Data Types</a>.</p>
<!-- @@@operator<< -->
<!-- $$$operator>>$$$operator>>QDataStream&QHostAddress& -->
<h3 class="fn"><a name="operator-gt-gt-98"></a><span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <span class="name">operator&gt;&gt;</span> ( <span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <i>in</i>, <span class="type">QHostAddress</span> &amp; <i>address</i> )</h3>
<p>Reads a host address into <i>address</i> from the stream <i>in</i> and returns a reference to the stream.</p>
<p><b>See also </b><a href="datastreamformat.html">Serializing Qt Data Types</a>.</p>
<!-- @@@operator>> -->
</div>
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2013 Digia Plc and/or its
      subsidiaries. Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      The documentation provided herein is licensed under the terms of the
      <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
      License version 1.3</a> as published by the Free Software Foundation.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      Digia, Qt and their respective logos are trademarks of Digia Plc 
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
  </div>

  <script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>