Sophie

Sophie

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

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" />
<!-- qhostinfo.cpp -->
  <title>Qt 4.8: QHostInfo 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>QHostInfo</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="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QHostInfo Class Reference</h1>
<!-- $$$QHostInfo-brief -->
<p>The QHostInfo class provides static functions for host name lookups. <a href="#details">More...</a></p>
<!-- @@@QHostInfo -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QHostInfo&gt;</span></pre><p><b>Note:</b> All functions in this class are <a href="threads-reentrancy.html#reentrant">reentrant</a>.</p>
<ul>
<li><a href="qhostinfo-members.html">List of all members, including inherited 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="qhostinfo.html#HostInfoError-enum">HostInfoError</a></b> { NoError, HostNotFound, UnknownError }</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="qhostinfo.html#QHostInfo">QHostInfo</a></b> ( int <i>id</i> = -1 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qhostinfo.html#QHostInfo-2">QHostInfo</a></b> ( const QHostInfo &amp; <i>other</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qhostinfo.html#dtor.QHostInfo">~QHostInfo</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QHostAddress&gt; </td><td class="memItemRight bottomAlign"><b><a href="qhostinfo.html#addresses">addresses</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> HostInfoError </td><td class="memItemRight bottomAlign"><b><a href="qhostinfo.html#error">error</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qhostinfo.html#errorString">errorString</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qhostinfo.html#hostName">hostName</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qhostinfo.html#lookupId">lookupId</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qhostinfo.html#setAddresses">setAddresses</a></b> ( const QList&lt;QHostAddress&gt; &amp; <i>addresses</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qhostinfo.html#setError">setError</a></b> ( HostInfoError <i>error</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qhostinfo.html#setErrorString">setErrorString</a></b> ( const QString &amp; <i>str</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qhostinfo.html#setHostName">setHostName</a></b> ( const QString &amp; <i>hostName</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qhostinfo.html#setLookupId">setLookupId</a></b> ( int <i>id</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QHostInfo &amp; </td><td class="memItemRight bottomAlign"><b><a href="qhostinfo.html#operator-eq">operator=</a></b> ( const QHostInfo &amp; <i>other</i> )</td></tr>
</table>
<a name="static-public-members"></a>
<h2>Static Public Members</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qhostinfo.html#abortHostLookup">abortHostLookup</a></b> ( int <i>id</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QHostInfo </td><td class="memItemRight bottomAlign"><b><a href="qhostinfo.html#fromName">fromName</a></b> ( const QString &amp; <i>name</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qhostinfo.html#localDomainName">localDomainName</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qhostinfo.html#localHostName">localHostName</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qhostinfo.html#lookupHost">lookupHost</a></b> ( const QString &amp; <i>name</i>, QObject * <i>receiver</i>, const char * <i>member</i> )</td></tr>
</table>
<a name="details"></a>
<!-- $$$QHostInfo-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QHostInfo class provides static functions for host name lookups.</p>
<p>QHostInfo uses the lookup mechanisms provided by the operating system to find the IP address(es) associated with a host name, or the host name associated with an IP address. The class provides two static convenience functions: one that works asynchronously and emits a signal once the host is found, and one that blocks and returns a QHostInfo object.</p>
<p>To look up a host's IP addresses asynchronously, call <a href="qhostinfo.html#lookupHost">lookupHost</a>(), which takes the host name or IP address, a receiver object, and a slot signature as arguments and returns an ID. You can abort the lookup by calling <a href="qhostinfo.html#abortHostLookup">abortHostLookup</a>() with the lookup ID.</p>
<p>Example:</p>
<pre class="cpp"> <span class="comment">// To find the IP address of qt.nokia.com</span>
 <span class="type">QHostInfo</span><span class="operator">::</span><a href="qhostinfo.html#lookupHost">lookupHost</a>(<span class="string">&quot;qt.nokia.com&quot;</span><span class="operator">,</span>
                       <span class="keyword">this</span><span class="operator">,</span> SLOT(printResults(<span class="type">QHostInfo</span>)));

 <span class="comment">// To find the host name for 4.2.2.1</span>
 <span class="type">QHostInfo</span><span class="operator">::</span><a href="qhostinfo.html#lookupHost">lookupHost</a>(<span class="string">&quot;4.2.2.1&quot;</span><span class="operator">,</span>
                       <span class="keyword">this</span><span class="operator">,</span> SLOT(printResults(<span class="type">QHostInfo</span>)));</pre>
<p>The slot is invoked when the results are ready. The results are stored in a QHostInfo object. Call <a href="qhostinfo.html#addresses">addresses</a>() to get the list of IP addresses for the host, and <a href="qhostinfo.html#hostName">hostName</a>() to get the host name that was looked up.</p>
<p>If the lookup failed, <a href="qhostinfo.html#error">error</a>() returns the type of error that occurred. <a href="qhostinfo.html#errorString">errorString</a>() gives a human-readable description of the lookup error.</p>
<p>If you want a blocking lookup, use the <a href="qhostinfo.html#fromName">QHostInfo::fromName</a>() function:</p>
<pre class="cpp"> <span class="type">QHostInfo</span> info <span class="operator">=</span> <span class="type">QHostInfo</span><span class="operator">::</span><a href="qhostinfo.html#fromName">fromName</a>(<span class="string">&quot;qt.nokia.com&quot;</span>);</pre>
<p>QHostInfo supports Internationalized Domain Names (IDNs) through the IDNA and Punycode standards.</p>
<p>To retrieve the name of the local host, use the static <a href="qhostinfo.html#localHostName">QHostInfo::localHostName</a>() function.</p>
<p><b>Note:</b> Since Qt 4.6&#x2e;1 QHostInfo is using multiple threads for DNS lookup instead of one dedicated DNS thread. This improves performance, but also changes the order of signal emissions when using <a href="qhostinfo.html#lookupHost">lookupHost</a>() compared to previous versions of Qt. <b>Note:</b> Since Qt 4.6&#x2e;3 QHostInfo is using a small internal 60 second DNS cache for performance improvements.</p>
</div>
<p><b>See also </b><a href="qabstractsocket.html">QAbstractSocket</a> and <a href="http://www.rfc-editor.org/rfc/rfc3492.txt">RFC 3492</a>.</p>
<!-- @@@QHostInfo -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$HostInfoError$$$NoError$$$HostNotFound$$$UnknownError -->
<h3 class="fn"><a name="HostInfoError-enum"></a>enum QHostInfo::<span class="name">HostInfoError</span></h3>
<p>This enum describes the various errors that can occur when trying to resolve a host name.</p>
<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>QHostInfo::NoError</tt></td><td class="topAlign"><tt>0</tt></td><td class="topAlign">The lookup was successful.</td></tr>
<tr><td class="topAlign"><tt>QHostInfo::HostNotFound</tt></td><td class="topAlign"><tt>1</tt></td><td class="topAlign">No IP addresses were found for the host.</td></tr>
<tr><td class="topAlign"><tt>QHostInfo::UnknownError</tt></td><td class="topAlign"><tt>2</tt></td><td class="topAlign">An unknown error occurred.</td></tr>
</table>
<p><b>See also </b><a href="qhostinfo.html#error">error</a>() and <a href="qhostinfo.html#setError">setError</a>().</p>
<!-- @@@HostInfoError -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QHostInfo[overload1]$$$QHostInfoint -->
<h3 class="fn"><a name="QHostInfo"></a>QHostInfo::<span class="name">QHostInfo</span> ( <span class="type">int</span> <i>id</i> = -1 )</h3>
<p>Constructs an empty host info object with lookup ID <i>id</i>.</p>
<p><b>See also </b><a href="qhostinfo.html#lookupId">lookupId</a>().</p>
<!-- @@@QHostInfo -->
<!-- $$$QHostInfo$$$QHostInfoconstQHostInfo& -->
<h3 class="fn"><a name="QHostInfo-2"></a>QHostInfo::<span class="name">QHostInfo</span> ( const <span class="type">QHostInfo</span> &amp; <i>other</i> )</h3>
<p>Constructs a copy of <i>other</i>.</p>
<!-- @@@QHostInfo -->
<!-- $$$~QHostInfo[overload1]$$$~QHostInfo -->
<h3 class="fn"><a name="dtor.QHostInfo"></a>QHostInfo::<span class="name">~QHostInfo</span> ()</h3>
<p>Destroys the host info object.</p>
<!-- @@@~QHostInfo -->
<!-- $$$abortHostLookup[overload1]$$$abortHostLookupint -->
<h3 class="fn"><a name="abortHostLookup"></a><span class="type">void</span> QHostInfo::<span class="name">abortHostLookup</span> ( <span class="type">int</span> <i>id</i> )<tt> [static]</tt></h3>
<p>Aborts the host lookup with the ID <i>id</i>, as returned by <a href="qhostinfo.html#lookupHost">lookupHost</a>().</p>
<p><b>See also </b><a href="qhostinfo.html#lookupHost">lookupHost</a>() and <a href="qhostinfo.html#lookupId">lookupId</a>().</p>
<!-- @@@abortHostLookup -->
<!-- $$$addresses[overload1]$$$addresses -->
<h3 class="fn"><a name="addresses"></a><span class="type"><a href="qlist.html">QList</a></span>&lt;<span class="type"><a href="qhostaddress.html">QHostAddress</a></span>&gt; QHostInfo::<span class="name">addresses</span> () const</h3>
<p>Returns the list of IP addresses associated with <a href="qhostinfo.html#hostName">hostName</a>(). This list may be empty.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qhostinfo.html">QHostInfo</a></span> info;
 <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
 <span class="keyword">if</span> (<span class="operator">!</span>info<span class="operator">.</span>addresses()<span class="operator">.</span>isEmpty()) {
     <span class="type"><a href="qhostaddress.html">QHostAddress</a></span> address <span class="operator">=</span> info<span class="operator">.</span>addresses()<span class="operator">.</span>first();
     <span class="comment">// use the first IP address</span>
 }</pre>
<p><b>See also </b><a href="qhostinfo.html#setAddresses">setAddresses</a>(), <a href="qhostinfo.html#hostName">hostName</a>(), and <a href="qhostinfo.html#error">error</a>().</p>
<!-- @@@addresses -->
<!-- $$$error[overload1]$$$error -->
<h3 class="fn"><a name="error"></a><span class="type"><a href="qhostinfo.html#HostInfoError-enum">HostInfoError</a></span> QHostInfo::<span class="name">error</span> () const</h3>
<p>Returns the type of error that occurred if the host name lookup failed; otherwise returns <a href="qhostinfo.html#HostInfoError-enum">NoError</a>.</p>
<p><b>See also </b><a href="qhostinfo.html#setError">setError</a>() and <a href="qhostinfo.html#errorString">errorString</a>().</p>
<!-- @@@error -->
<!-- $$$errorString[overload1]$$$errorString -->
<h3 class="fn"><a name="errorString"></a><span class="type"><a href="qstring.html">QString</a></span> QHostInfo::<span class="name">errorString</span> () const</h3>
<p>If the lookup failed, this function returns a human readable description of the error; otherwise &quot;Unknown error&quot; is returned.</p>
<p><b>See also </b><a href="qhostinfo.html#setErrorString">setErrorString</a>() and <a href="qhostinfo.html#error">error</a>().</p>
<!-- @@@errorString -->
<!-- $$$fromName[overload1]$$$fromNameconstQString& -->
<h3 class="fn"><a name="fromName"></a><span class="type">QHostInfo</span> QHostInfo::<span class="name">fromName</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>name</i> )<tt> [static]</tt></h3>
<p>Looks up the IP address(es) for the given host <i>name</i>. The function blocks during the lookup which means that execution of the program is suspended until the results of the lookup are ready. Returns the result of the lookup in a <a href="qhostinfo.html">QHostInfo</a> object.</p>
<p>If you pass a literal IP address to <i>name</i> instead of a host name, <a href="qhostinfo.html">QHostInfo</a> will search for the domain name for the IP (i.e&#x2e;, <a href="qhostinfo.html">QHostInfo</a> will perform a <i>reverse</i> lookup). On success, the returned <a href="qhostinfo.html">QHostInfo</a> will contain both the resolved domain name and IP addresses for the host name.</p>
<p><b>See also </b><a href="qhostinfo.html#lookupHost">lookupHost</a>().</p>
<!-- @@@fromName -->
<!-- $$$hostName[overload1]$$$hostName -->
<h3 class="fn"><a name="hostName"></a><span class="type"><a href="qstring.html">QString</a></span> QHostInfo::<span class="name">hostName</span> () const</h3>
<p>Returns the name of the host whose IP addresses were looked up.</p>
<p><b>See also </b><a href="qhostinfo.html#setHostName">setHostName</a>() and <a href="qhostinfo.html#localHostName">localHostName</a>().</p>
<!-- @@@hostName -->
<!-- $$$localDomainName[overload1]$$$localDomainName -->
<h3 class="fn"><a name="localDomainName"></a><span class="type"><a href="qstring.html">QString</a></span> QHostInfo::<span class="name">localDomainName</span> ()<tt> [static]</tt></h3>
<p>Returns the DNS domain of this machine.</p>
<p>Note: DNS domains are not related to domain names found in Windows networks.</p>
<p><b>See also </b><a href="qhostinfo.html#hostName">hostName</a>().</p>
<!-- @@@localDomainName -->
<!-- $$$localHostName[overload1]$$$localHostName -->
<h3 class="fn"><a name="localHostName"></a><span class="type"><a href="qstring.html">QString</a></span> QHostInfo::<span class="name">localHostName</span> ()<tt> [static]</tt></h3>
<p>Returns the host name of this machine.</p>
<p><b>See also </b><a href="qhostinfo.html#hostName">hostName</a>().</p>
<!-- @@@localHostName -->
<!-- $$$lookupHost[overload1]$$$lookupHostconstQString&QObject*constchar* -->
<h3 class="fn"><a name="lookupHost"></a><span class="type">int</span> QHostInfo::<span class="name">lookupHost</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>name</i>, <span class="type"><a href="qobject.html">QObject</a></span> * <i>receiver</i>, const <span class="type">char</span> * <i>member</i> )<tt> [static]</tt></h3>
<p>Looks up the IP address(es) associated with host name <i>name</i>, and returns an ID for the lookup. When the result of the lookup is ready, the slot or signal <i>member</i> in <i>receiver</i> is called with a <a href="qhostinfo.html">QHostInfo</a> argument. The <a href="qhostinfo.html">QHostInfo</a> object can then be inspected to get the results of the lookup.</p>
<p>The lookup is performed by a single function call, for example:</p>
<pre class="cpp"> <span class="type"><a href="qhostinfo.html">QHostInfo</a></span><span class="operator">::</span>lookupHost(<span class="string">&quot;www.kde.org&quot;</span><span class="operator">,</span>
                       <span class="keyword">this</span><span class="operator">,</span> SLOT(lookedUp(<span class="type"><a href="qhostinfo.html">QHostInfo</a></span>)));</pre>
<p>The implementation of the slot prints basic information about the addresses returned by the lookup, or reports an error if it failed:</p>
<pre class="cpp"> <span class="type">void</span> MyWidget<span class="operator">::</span>lookedUp(<span class="keyword">const</span> <span class="type"><a href="qhostinfo.html">QHostInfo</a></span> <span class="operator">&amp;</span>host)
 {
     <span class="keyword">if</span> (host<span class="operator">.</span>error() <span class="operator">!</span><span class="operator">=</span> <span class="type"><a href="qhostinfo.html">QHostInfo</a></span><span class="operator">::</span>NoError) {
         <a href="qtglobal.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;Lookup failed:&quot;</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> host<span class="operator">.</span>errorString();
         <span class="keyword">return</span>;
     }

     foreach (<span class="keyword">const</span> <span class="type"><a href="qhostaddress.html">QHostAddress</a></span> <span class="operator">&amp;</span>address<span class="operator">,</span> host<span class="operator">.</span>addresses())
         <a href="qtglobal.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;Found address:&quot;</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> address<span class="operator">.</span>toString();
 }</pre>
<p>If you pass a literal IP address to <i>name</i> instead of a host name, <a href="qhostinfo.html">QHostInfo</a> will search for the domain name for the IP (i.e&#x2e;, <a href="qhostinfo.html">QHostInfo</a> will perform a <i>reverse</i> lookup). On success, the resulting <a href="qhostinfo.html">QHostInfo</a> will contain both the resolved domain name and IP addresses for the host name. Example:</p>
<pre class="cpp"> <span class="type"><a href="qhostinfo.html">QHostInfo</a></span><span class="operator">::</span>lookupHost(<span class="string">&quot;4.2.2.1&quot;</span><span class="operator">,</span>
                       <span class="keyword">this</span><span class="operator">,</span> SLOT(lookedUp(<span class="type"><a href="qhostinfo.html">QHostInfo</a></span>)));</pre>
<p><b>Note:</b> There is no guarantee on the order the signals will be emitted if you start multiple requests with lookupHost().</p>
<p><b>See also </b><a href="qhostinfo.html#abortHostLookup">abortHostLookup</a>(), <a href="qhostinfo.html#addresses">addresses</a>(), <a href="qhostinfo.html#error">error</a>(), and <a href="qhostinfo.html#fromName">fromName</a>().</p>
<!-- @@@lookupHost -->
<!-- $$$lookupId[overload1]$$$lookupId -->
<h3 class="fn"><a name="lookupId"></a><span class="type">int</span> QHostInfo::<span class="name">lookupId</span> () const</h3>
<p>Returns the ID of this lookup.</p>
<p><b>See also </b><a href="qhostinfo.html#setLookupId">setLookupId</a>(), <a href="qhostinfo.html#abortHostLookup">abortHostLookup</a>(), and <a href="qhostinfo.html#hostName">hostName</a>().</p>
<!-- @@@lookupId -->
<!-- $$$setAddresses[overload1]$$$setAddressesconstQList<QHostAddress>& -->
<h3 class="fn"><a name="setAddresses"></a><span class="type">void</span> QHostInfo::<span class="name">setAddresses</span> ( const <span class="type"><a href="qlist.html">QList</a></span>&lt;<span class="type"><a href="qhostaddress.html">QHostAddress</a></span>&gt; &amp; <i>addresses</i> )</h3>
<p>Sets the list of addresses in this <a href="qhostinfo.html">QHostInfo</a> to <i>addresses</i>.</p>
<p><b>See also </b><a href="qhostinfo.html#addresses">addresses</a>().</p>
<!-- @@@setAddresses -->
<!-- $$$setError[overload1]$$$setErrorHostInfoError -->
<h3 class="fn"><a name="setError"></a><span class="type">void</span> QHostInfo::<span class="name">setError</span> ( <span class="type"><a href="qhostinfo.html#HostInfoError-enum">HostInfoError</a></span> <i>error</i> )</h3>
<p>Sets the error type of this <a href="qhostinfo.html">QHostInfo</a> to <i>error</i>.</p>
<p><b>See also </b><a href="qhostinfo.html#error">error</a>() and <a href="qhostinfo.html#errorString">errorString</a>().</p>
<!-- @@@setError -->
<!-- $$$setErrorString[overload1]$$$setErrorStringconstQString& -->
<h3 class="fn"><a name="setErrorString"></a><span class="type">void</span> QHostInfo::<span class="name">setErrorString</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>str</i> )</h3>
<p>Sets the human readable description of the error that occurred to <i>str</i> if the lookup failed.</p>
<p><b>See also </b><a href="qhostinfo.html#errorString">errorString</a>() and <a href="qhostinfo.html#setError">setError</a>().</p>
<!-- @@@setErrorString -->
<!-- $$$setHostName[overload1]$$$setHostNameconstQString& -->
<h3 class="fn"><a name="setHostName"></a><span class="type">void</span> QHostInfo::<span class="name">setHostName</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>hostName</i> )</h3>
<p>Sets the host name of this <a href="qhostinfo.html">QHostInfo</a> to <i>hostName</i>.</p>
<p><b>See also </b><a href="qhostinfo.html#hostName">hostName</a>().</p>
<!-- @@@setHostName -->
<!-- $$$setLookupId[overload1]$$$setLookupIdint -->
<h3 class="fn"><a name="setLookupId"></a><span class="type">void</span> QHostInfo::<span class="name">setLookupId</span> ( <span class="type">int</span> <i>id</i> )</h3>
<p>Sets the ID of this lookup to <i>id</i>.</p>
<p><b>See also </b><a href="qhostinfo.html#lookupId">lookupId</a>() and <a href="qhostinfo.html#lookupHost">lookupHost</a>().</p>
<!-- @@@setLookupId -->
<!-- $$$operator=[overload1]$$$operator=constQHostInfo& -->
<h3 class="fn"><a name="operator-eq"></a><span class="type">QHostInfo</span> &amp; QHostInfo::<span class="name">operator=</span> ( const <span class="type">QHostInfo</span> &amp; <i>other</i> )</h3>
<p>Assigns the data of the <i>other</i> object to this host info object, and returns a reference to it.</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>