Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > a6711891ce757817bba854bf3f25205a > files > 2066

qtjambi-doc-4.3.3-3mdv2008.1.i586.rpm

<class name="QHostInfo" doc="/**
&lt;p&gt;The &lt;a href=&quot;QHostInfo.html#QHostInfo(com.trolltech.qt.network.QHostInfo)&quot;&gt;&lt;tt&gt;QHostInfo&lt;/tt&gt;&lt;/a&gt; class provides static functions for host name lookups.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;QHostInfo.html#QHostInfo(com.trolltech.qt.network.QHostInfo)&quot;&gt;&lt;tt&gt;QHostInfo&lt;/tt&gt;&lt;/a&gt; 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 &lt;a href=&quot;QHostInfo.html#QHostInfo(com.trolltech.qt.network.QHostInfo)&quot;&gt;&lt;tt&gt;QHostInfo&lt;/tt&gt;&lt;/a&gt; object.&lt;/p&gt;
&lt;p&gt;To look up a host's IP addresses asynchronously, call lookupHost(), 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 &lt;a href=&quot;QHostInfo.html#abortHostLookup(int)&quot;&gt;&lt;tt&gt;abortHostLookup&lt;/tt&gt;&lt;/a&gt; with the lookup ID.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre&gt;&lt;span class=&quot;comment&quot;&gt;    // To find the IP address of www.trolltech.com&lt;/span&gt;
    QHostInfo::lookupHost(&amp;quot;www.trolltech.com&amp;quot;,
                          this, SLOT(printResults(QHostInfo)));

&lt;span class=&quot;comment&quot;&gt;    // To find the host name for 4.2.2.1&lt;/span&gt;
    QHostInfo::lookupHost(&amp;quot;4.2.2.1&amp;quot;,
                          this, SLOT(printResults(QHostInfo)));&lt;/pre&gt;
&lt;p&gt;The slot is invoked when the results are ready. (If you use Qtopia Core and disabled multithread support by defining &lt;tt&gt;QT_NO_THREAD&lt;/tt&gt;, lookupHost() will block until the lookup has finished.) The results are stored in a &lt;a href=&quot;QHostInfo.html#QHostInfo(com.trolltech.qt.network.QHostInfo)&quot;&gt;&lt;tt&gt;QHostInfo&lt;/tt&gt;&lt;/a&gt; object. Call &lt;a href=&quot;QHostInfo.html#addresses()&quot;&gt;&lt;tt&gt;addresses&lt;/tt&gt;&lt;/a&gt; to get the list of IP addresses for the host, and &lt;a href=&quot;QHostInfo.html#hostName()&quot;&gt;&lt;tt&gt;hostName&lt;/tt&gt;&lt;/a&gt; to get the host name that was looked up.&lt;/p&gt;
&lt;p&gt;If the lookup failed, &lt;a href=&quot;QHostInfo.html#error()&quot;&gt;&lt;tt&gt;error&lt;/tt&gt;&lt;/a&gt; returns the type of error that occurred. &lt;a href=&quot;QHostInfo.html#errorString()&quot;&gt;&lt;tt&gt;errorString&lt;/tt&gt;&lt;/a&gt; gives a human-readable description of the lookup error.&lt;/p&gt;
&lt;p&gt;If you want a blocking lookup, use the QHostInfo::fromName() function:&lt;/p&gt;
&lt;pre&gt;    QHostInfo info = QHostInfo::fromName(&amp;quot;www.trolltech.com&amp;quot;);&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;QHostInfo.html#QHostInfo(com.trolltech.qt.network.QHostInfo)&quot;&gt;&lt;tt&gt;QHostInfo&lt;/tt&gt;&lt;/a&gt; supports Internationalized Domain Names (IDNs) through the IDNA and Punycode standards.&lt;/p&gt;
&lt;p&gt;To retrieve the name of the local host, use the static QHostInfo::localHostName() function.&lt;/p&gt;

@see &lt;a href=&quot;QAbstractSocket.html&quot;&gt;&lt;tt&gt;QAbstractSocket&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;http://www.rfc-editor.org/rfc/rfc3492.txt&quot;&gt;RFC 3492&lt;/tt&gt;&lt;/a&gt; */">
    <method name="public QHostInfo(int lookupId)" doc="/**
&lt;p&gt;Constructs an empty host info object with lookup ID &lt;tt&gt;lookupId&lt;/tt&gt;.&lt;/p&gt;

@see &lt;a href=&quot;QHostInfo.html#lookupId()&quot;&gt;&lt;tt&gt;lookupId&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public QHostInfo()" doc="/**
&lt;p&gt;Equivalent to &lt;a href=&quot;QHostInfo.html#QHostInfo(com.trolltech.qt.network.QHostInfo)&quot;&gt;&lt;tt&gt;QHostInfo&lt;/tt&gt;&lt;/a&gt;(-1). */"/>
    <method name="public QHostInfo(com.trolltech.qt.network.QHostInfo d)" doc="/**
&lt;p&gt;Constructs a copy of &lt;tt&gt;d&lt;/tt&gt;.&lt;/p&gt;
 */"/>
    <method name="public final java.util.List&lt;com.trolltech.qt.network.QHostAddress&gt; addresses()" doc="/**
&lt;p&gt;Returns the list of IP addresses associated with &lt;a href=&quot;QHostInfo.html#hostName()&quot;&gt;&lt;tt&gt;hostName&lt;/tt&gt;&lt;/a&gt;. This list may be empty.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre&gt;    QHostInfo info;
    ...
    if (!info.addresses().isEmpty()) {
        QHostAddress address = info.addresses().first();
        &lt;span class=&quot;comment&quot;&gt;// use the first IP address&lt;/span&gt;
    }&lt;/pre&gt;

@see &lt;a href=&quot;QHostInfo.html#setAddresses(java.util.List&lt;com.trolltech.qt.network.QHostAddress&gt;)&quot;&gt;&lt;tt&gt;setAddresses&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QHostInfo.html#hostName()&quot;&gt;&lt;tt&gt;hostName&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QHostInfo.html#error()&quot;&gt;&lt;tt&gt;error&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final com.trolltech.qt.network.QHostInfo.HostInfoError error()" doc="/**
&lt;p&gt;Returns the type of error that occurred if the host name lookup failed; otherwise returns &lt;a href=&quot;QHostInfo.html#HostInfoError-enum&quot;&gt;&lt;tt&gt;NoError&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;

@see &lt;a href=&quot;QHostInfo.html#setError(com.trolltech.qt.network.QHostInfo.HostInfoError)&quot;&gt;&lt;tt&gt;setError&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QHostInfo.html#errorString()&quot;&gt;&lt;tt&gt;errorString&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final java.lang.String errorString()" doc="/**
&lt;p&gt;If the lookup failed, this function returns a human readable description of the error; otherwise &amp;quot;Unknown error&amp;quot; is returned.&lt;/p&gt;

@see &lt;a href=&quot;QHostInfo.html#setErrorString(java.lang.String)&quot;&gt;&lt;tt&gt;setErrorString&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QHostInfo.html#error()&quot;&gt;&lt;tt&gt;error&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final java.lang.String hostName()" doc="/**
&lt;p&gt;Returns the name of the host whose IP addresses were looked up.&lt;/p&gt;

@see &lt;a href=&quot;QHostInfo.html#setHostName(java.lang.String)&quot;&gt;&lt;tt&gt;setHostName&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QHostInfo.html#localHostName()&quot;&gt;&lt;tt&gt;localHostName&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final int lookupId()" doc="/**
&lt;p&gt;Returns the ID of this lookup.&lt;/p&gt;

@see &lt;a href=&quot;QHostInfo.html#setLookupId(int)&quot;&gt;&lt;tt&gt;setLookupId&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QHostInfo.html#abortHostLookup(int)&quot;&gt;&lt;tt&gt;abortHostLookup&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QHostInfo.html#hostName()&quot;&gt;&lt;tt&gt;hostName&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final void setAddresses(java.util.List&lt;com.trolltech.qt.network.QHostAddress&gt; addresses)" doc="/**
&lt;p&gt;Sets the list of addresses in this &lt;a href=&quot;QHostInfo.html#QHostInfo(com.trolltech.qt.network.QHostInfo)&quot;&gt;&lt;tt&gt;QHostInfo&lt;/tt&gt;&lt;/a&gt; to &lt;tt&gt;addresses&lt;/tt&gt;.&lt;/p&gt;

@see &lt;a href=&quot;QHostInfo.html#addresses()&quot;&gt;&lt;tt&gt;addresses&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final void setError(com.trolltech.qt.network.QHostInfo.HostInfoError error)" doc="/**
&lt;p&gt;Sets the error type of this &lt;a href=&quot;QHostInfo.html#QHostInfo(com.trolltech.qt.network.QHostInfo)&quot;&gt;&lt;tt&gt;QHostInfo&lt;/tt&gt;&lt;/a&gt; to &lt;tt&gt;error&lt;/tt&gt;.&lt;/p&gt;

@see &lt;a href=&quot;QHostInfo.html#error()&quot;&gt;&lt;tt&gt;error&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QHostInfo.html#errorString()&quot;&gt;&lt;tt&gt;errorString&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final void setErrorString(java.lang.String errorString)" doc="/**
&lt;p&gt;Sets the human readable description of the error that occurred to &lt;tt&gt;errorString&lt;/tt&gt; if the lookup failed.&lt;/p&gt;

@see &lt;a href=&quot;QHostInfo.html#errorString()&quot;&gt;&lt;tt&gt;errorString&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QHostInfo.html#setError(com.trolltech.qt.network.QHostInfo.HostInfoError)&quot;&gt;&lt;tt&gt;setError&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final void setHostName(java.lang.String name)" doc="/**
&lt;p&gt;Sets the host name of this &lt;a href=&quot;QHostInfo.html#QHostInfo(com.trolltech.qt.network.QHostInfo)&quot;&gt;&lt;tt&gt;QHostInfo&lt;/tt&gt;&lt;/a&gt; to &lt;tt&gt;name&lt;/tt&gt;.&lt;/p&gt;

@see &lt;a href=&quot;QHostInfo.html#hostName()&quot;&gt;&lt;tt&gt;hostName&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final void setLookupId(int id)" doc="/**
&lt;p&gt;Sets the ID of this lookup to &lt;tt&gt;id&lt;/tt&gt;.&lt;/p&gt;

@see &lt;a href=&quot;QHostInfo.html#lookupId()&quot;&gt;&lt;tt&gt;lookupId&lt;/tt&gt;&lt;/a&gt;
@see &lt;tt&gt;lookupHost&lt;/tt&gt; */"/>
    <method name="public native static void abortHostLookup(int lookupId)" doc="/**
&lt;p&gt;Aborts the host lookup with the ID &lt;tt&gt;lookupId&lt;/tt&gt;, as returned by lookupHost().&lt;/p&gt;

@see &lt;tt&gt;lookupHost&lt;/tt&gt;
@see &lt;a href=&quot;QHostInfo.html#lookupId()&quot;&gt;&lt;tt&gt;lookupId&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public native static com.trolltech.qt.network.QHostInfo fromName(java.lang.String name)" doc="/**
&lt;p&gt;Looks up the IP address(es) for the given host &lt;tt&gt;name&lt;/tt&gt;. 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 &lt;a href=&quot;QHostInfo.html#QHostInfo(com.trolltech.qt.network.QHostInfo)&quot;&gt;&lt;tt&gt;QHostInfo&lt;/tt&gt;&lt;/a&gt; object.&lt;/p&gt;
&lt;p&gt;If you pass a literal IP address to &lt;tt&gt;name&lt;/tt&gt; instead of a host name, &lt;a href=&quot;QHostInfo.html#QHostInfo(com.trolltech.qt.network.QHostInfo)&quot;&gt;&lt;tt&gt;QHostInfo&lt;/tt&gt;&lt;/a&gt; will search for the domain name for the IP (i.e&amp;#x2e;, &lt;a href=&quot;QHostInfo.html#QHostInfo(com.trolltech.qt.network.QHostInfo)&quot;&gt;&lt;tt&gt;QHostInfo&lt;/tt&gt;&lt;/a&gt; will perform a &lt;i&gt;reverse&lt;/i&gt; lookup). On success, the returned &lt;a href=&quot;QHostInfo.html#QHostInfo(com.trolltech.qt.network.QHostInfo)&quot;&gt;&lt;tt&gt;QHostInfo&lt;/tt&gt;&lt;/a&gt; will contain both the resolved domain name and IP addresses for the host name.&lt;/p&gt;

@see &lt;tt&gt;lookupHost&lt;/tt&gt; */"/>
    <method name="public native static java.lang.String localHostName()" doc="/**
&lt;p&gt;Returns the host name of this machine.&lt;/p&gt;

@see &lt;a href=&quot;QHostInfo.html#hostName()&quot;&gt;&lt;tt&gt;hostName&lt;/tt&gt;&lt;/a&gt; */"/>
    <enum name="HostInfoError" doc="/**
&lt;p&gt;This enum describes the various errors that can occur when trying to resolve a host name.&lt;/p&gt;

@see &lt;a href=&quot;QHostInfo.html#error()&quot;&gt;&lt;tt&gt;error&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QHostInfo.html#setError(com.trolltech.qt.network.QHostInfo.HostInfoError)&quot;&gt;&lt;tt&gt;setError&lt;/tt&gt;&lt;/a&gt; */">
        <enum-value name="NoError" doc="/**
&lt;p&gt;The lookup was successful.&lt;/p&gt;
 */"/>
        <enum-value name="HostNotFound" doc="/**
&lt;p&gt;No IP addresses were found for the host.&lt;/p&gt;
 */"/>
        <enum-value name="UnknownError" doc="/**
&lt;p&gt;An unknown error occurred.&lt;/p&gt;
 */"/>
</enum>
</class>