<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--Converted with LaTeX2HTML 98.2 beta6 (August 14th, 1998)
original version by:  Nikos Drakos, CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>6.1 DNR Result Objects </TITLE>
<META NAME="description" CONTENT="6.1 DNR Result Objects ">
<META NAME="keywords" CONTENT="mac">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<LINK REL="STYLESHEET" HREF="mac.css">
<LINK REL="previous" HREF="module-macdnr.html">
<LINK REL="up" HREF="module-macdnr.html">
<LINK REL="next" HREF="module-macfs.html">
</HEAD>
<BODY bgcolor="#ffffff">
<div class=navigation>
<table align=center width="100%" cellpadding=0 cellspacing=2>
<tr>
<td><A HREF="module-macfs.html"><img width=32 height=32 align=bottom border=0 alt="next"
 src="../icons/next.gif"></A></td>
<td><A HREF="module-macdnr.html"><img width=32 height=32 align=bottom border=0 alt="up"
 src="../icons/up.gif"></A></td>
<td><A HREF="module-macdnr.html"><img width=32 height=32 align=bottom border=0 alt="previous"
 src="../icons/previous.gif"></A></td>
<td align=center bgcolor="#99CCFF" width="100%">
 <b class=title>Macintosh Library Modules</b></td>
<td><A HREF="contents.html"><img width=32 height=32 align=bottom border=0 alt="contents"
 src="../icons/contents.gif"></A></td>
<td><a
 href="modindex.html"><img width=32 height=32 align=bottom border=0 alt="modules"
 src="../icons/modules.gif"></a></td>
<td><A HREF="genindex.html"><img width=32 height=32 align=bottom border=0 alt="index"
 src="../icons/index.gif"></A></td>
</tr></table><b class=navlabel>Next:</b> <span class=sectref><A HREF="module-macfs.html">7. macfs  </A></span>
<b class=navlabel>Up:</b> <span class=sectref><A HREF="module-macdnr.html">6. macdnr  </A></span>
<b class=navlabel>Previous:</b> <span class=sectref><A HREF="module-macdnr.html">6. macdnr  </A></span>
<br><hr></div>
<!--End of Navigation Panel-->

<H2><A NAME="SECTION002610000000000000000"></A>
<BR>
6.1 DNR Result Objects 
</H2>

<P>
Since the DNR calls all execute asynchronously you do not get the
results back immediately.  Instead, you get a dnr result object.  You
can check this object to see whether the query is complete, and access
its attributes to obtain the information when it is.

<P>
Alternatively, you can also reference the result attributes directly,
this will result in an implicit wait for the query to complete.

<P>
The <tt class=member>rtnCode</tt> and <tt class=member>cname</tt> attributes are always
available, the others depend on the type of query (address, hinfo or
mx).

<P>
<dl><dt><b><a name="l2h-72"><tt class=method>wait</tt></a></b> ()
<dd>
Wait for the query to complete.
</dl>

<P>
<dl><dt><b><a name="l2h-73"><tt class=method>isdone</tt></a></b> ()
<dd>
Return <tt>1</tt> if the query is complete.
</dl>

<P>
<dl><dt><b><a name="l2h-74"><tt class=member>rtnCode</tt></a></b>
<dd>
The error code returned by the query.
</dl>

<P>
<dl><dt><b><a name="l2h-75"><tt class=member>cname</tt></a></b>
<dd>
The canonical name of the host that was queried.
</dl>

<P>
<dl><dt><b><a name="l2h-76"><tt class=member>ip0</tt></a></b>
<dd>
<dt><b><a name="l2h-77"><tt class=member>ip1</tt></a></b><dd><dt><b><a name="l2h-78"><tt class=member>ip2</tt></a></b><dd><dt><b><a name="l2h-79"><tt class=member>ip3</tt></a></b><dd>At most four integer IP addresses for this host.  Unused entries are
zero.  Valid only for address queries.
</dl>

<P>
<dl><dt><b><a name="l2h-80"><tt class=member>cpuType</tt></a></b>
<dd>
<dt><b><a name="l2h-81"><tt class=member>osType</tt></a></b><dd>Textual strings giving the machine type an OS name.  Valid for ``hinfo''
queries.
</dl>

<P>
<dl><dt><b><a name="l2h-82"><tt class=member>exchange</tt></a></b>
<dd>
The name of a mail-exchanger host.  Valid for ``mx'' queries.
</dl>

<P>
<dl><dt><b><a name="l2h-83"><tt class=member>preference</tt></a></b>
<dd>
The preference of this mx record.  Not too useful, since the Macintosh
will only return a single mx record.  Valid for ``mx'' queries only.
</dl>

<P>
The simplest way to use the module to convert names to dotted-decimal
strings, without worrying about idle time, etc:

<P>
<dl><dd><pre class=verbatim>
&gt;&gt;&gt; def gethostname(name):
...     import macdnr
...     dnrr = macdnr.StrToAddr(name)
...     return macdnr.AddrToStr(dnrr.ip0)
</pre></dl><p>
<div class=navigation><hr><table align=center width="100%" cellpadding=0 cellspacing=2>
<tr>
<td><A HREF="module-macfs.html"><img width=32 height=32 align=bottom border=0 alt="next"
 src="../icons/next.gif"></A></td>
<td><A HREF="module-macdnr.html"><img width=32 height=32 align=bottom border=0 alt="up"
 src="../icons/up.gif"></A></td>
<td><A HREF="module-macdnr.html"><img width=32 height=32 align=bottom border=0 alt="previous"
 src="../icons/previous.gif"></A></td>
<td align=center bgcolor="#99CCFF" width="100%">
 <b class=title>Macintosh Library Modules</b></td>
<td><A HREF="contents.html"><img width=32 height=32 align=bottom border=0 alt="contents"
 src="../icons/contents.gif"></A></td>
<td><a
 href="modindex.html"><img width=32 height=32 align=bottom border=0 alt="modules"
 src="../icons/modules.gif"></a></td>
<td><A HREF="genindex.html"><img width=32 height=32 align=bottom border=0 alt="index"
 src="../icons/index.gif"></A></td>
</tr></table><b class=navlabel>Next:</b> <span class=sectref><A HREF="module-macfs.html">7. macfs  </A></span>
<b class=navlabel>Up:</b> <span class=sectref><A HREF="module-macdnr.html">6. macdnr  </A></span>
<b class=navlabel>Previous:</b> <span class=sectref><A HREF="module-macdnr.html">6. macdnr  </A></span>
</div>
<!--End of Navigation Panel-->
<ADDRESS>
<hr>Send comments on this document to <a href="mailto:python-docs@python.org">python-docs@python.org</a>.
</ADDRESS>
</BODY>
</HTML>
