⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme.htm

📁 发送邮件
💻 HTM
📖 第 1 页 / 共 2 页
字号:
        <P>
        In Windows 2000, you'll find an implementation of nslookup. Type 'help' to
        get the full syntax of nslookup commands:
        <FONT SIZE=-1>
        <PRE>
        > <B>help</B>
        Commands:   (identifiers are shown in uppercase, [] means optional)
        NAME            - print info about the host/domain NAME using default server
        NAME1 NAME2     - as above, but use NAME2 as server
        help or ?       - print info on common commands
        set OPTION      - set an option
            all                 - print options, current server and host
            [no]debug           - print debugging information
            [no]d2              - print exhaustive debugging information
            [no]defname         - append domain name to each query
            [no]recurse         - ask for recursive answer to query
            [no]search          - use domain search list
            [no]vc              - always use a virtual circuit
            domain=NAME         - set default domain name to NAME
            srchlist=N1[/N2/.../N6] - set domain to N1 and search list to N1,N2, etc.
            root=NAME           - set root server to NAME
            retry=X             - set number of retries to X
            timeout=X           - set initial time-out interval to X seconds
            type=X              - set query type (ex. A,ANY,CNAME,MX,NS,PTR,SOA,SRV)
            querytype=X         - same as type
            class=X             - set query class (ex. IN (Internet), ANY)
            [no]msxfr           - use MS fast zone transfer
            ixfrver=X           - current version to use in IXFR transfer request
        server NAME     - set default server to NAME, using current default server
        lserver NAME    - set default server to NAME, using initial server
        finger [USER]   - finger the optional NAME at the current default host
        root            - set current default server to the root
        ls [opt] DOMAIN [> FILE] - list addresses in DOMAIN (optional: output to FILE)
            -a          -  list canonical names and aliases
            -d          -  list all records
            -t TYPE     -  list records of the given type (e.g. A,CNAME,MX,NS,PTR etc.)
        view FILE           - sort an 'ls' output file and view it with pg
        exit            - exit the program
        >
        </PRE>
        </FONT>
        </P>
    </UL>


    <A NAME="DNS Magic: Who's my email server?">
    <h4>DNS Magic: Who's my email server?</h4>
    </A>

    <UL>

        <P>There's a strong link between Internet email and the DNS. Mail servers use
        the DNS information database to route email messages from the originator to the 
        recipient.</P>

        <P>Basically, when the recipient email address is "someone@somewhere.com", the
        mail server searches the mail server (or Mail eXchanger) for domain "somewhere.com"
        in the DNS database. It then connects to the mail server (on port 25) and sends
        the email using SMTP.</P>

        <P>Mail servers are registered in the DNS database as <EM><B>"Mail eXchanger" ("MX")</B></EM> records.
        Note that there can be several registered mail servers for a given domain (with a 
        <EM><B>preference</B></EM> assigned to each server).</P>

        <P>Using nslookup, you can find the email server of your domain, as shown in the
        sample session below.</P>

        <UL>
            <LI>Start a MS-DOS command prompt and type the nslookup command:<BR>
            <PRE>
        C:\> <B>nslookup</B>
        Default Server:  youserver.yourdomain
        Address:  X.X.X.X
        > <B>set type=MX</B>
        > <B>microsoft.com</B>
        microsoft.com   MX preference = 10, mail exchanger = mail1.microsoft.com
        microsoft.com   MX preference = 20, mail exchanger = mail2.microsoft.com
        microsoft.com   MX preference = 30, mail exchanger = mail3.microsoft.com
        microsoft.com   MX preference = 40, mail exchanger = mail4.microsoft.com
        microsoft.com   MX preference = 50, mail exchanger = mail5.microsoft.com
            </PRE>
        </UL>

        <P>The lowest preference indicates the best (primary) mail server. A mailer would
        try it first and if it cannot connect to this server, it would use other servers
        (by order of preference).</P>

        <P>You can test this "DNS Magic" by using the nslookup program shipped with Windows 2000, 
        or with the <A HREF="TestDNSMagic.htm">DNS Magic HTML page</A>. This component 
        provides 
        method <A HREF="CSimpleDNSClient.html#STDMETHOD(GetEmailServers)(_BSTR_BDomainName,_VARIANT_*pvEmailServerNames)$">ISimpleDNSClient::GetEmailServers()</A> 
        to find the registered email servers for a given domain.</P>

        <P>For more about email and DNS, please see the <A HREF="#REFERENCE DOCUMENTATION">reference documentation.</A></P>
    </UL>


</UL>

<P><HR></P>

<A NAME="COMPONENT FEATURES">
<h3>COMPONENT FEATURES</h3>
</A>

This component:
<UL>
    <LI>implements the basics of DNS, as defined in 
        <A HREF="http://www.ietf.org/rfc/rfc1034.txt">RFC1034</A> and
        <A HREF="http://www.ietf.org/rfc/rfc1035.txt">RFC1035</A>,
    <LI>uses the resolver cache, queries first with UDP, then retries with TCP if the response is truncated
    <LI>asks the server to perform recursive resolution on behalf of the client to resolve the query
    <LI>finds DNS server addresses in local configuration (using API or Windows Registry)
    <LI>provides extended error information (ISupportErrorInfo and IErrorInfo are implemented)
    <LI>provides very small executable: 52 KB (MinSize) to 60 KB (MinDependency)
    <LI>requires no Graphical User Interface: the component can be used in non-GUI applications, like a Windows NT Service.
    <LI>is integrated with SimpleEmailClient (another component): the latter calls method GetEmailServers to automatically find SMTP servers
    <LI>runs on Windows 2000 (relies on Windows DNS API from the Platform SDK, August 2001)
    <LI>compiles with VC++ 6.0 SP5
</UL>


<P><HR></P>

<A NAME="USAGE">
<h3>USAGE</h3>
</A>

To use this component:
<UL>
    <LI>create an instance of the component,
    <LI>(optionally) put/get properties from interface ISimpleDNSClient:
    <UL>
        <LI>ServerAddresses
        <LI>Separator
    </UL>
    <LI>call a method from interface ISimpleDNSClient:
    <UL>
        <LI><A HREF="CSimpleDNSClient.html#STDMETHOD(Resolve)(_BSTR_BSearchedName,_VARIANT_*pvFoundNames,_BSTR_BResourceClass,_BSTR_BResourceType)$">Resolve</A>
        <LI><A HREF="CSimpleDNSClient.html#STDMETHOD(GetEmailServers)(_BSTR_BDomainName,_VARIANT_*pvEmailServerNames)$">GetEmailServers</A>
        <LI><A HREF="CSimpleDNSClient.html#STDMETHOD(GetDNSDomain)(_VARIANT_*pvDNSDomainName)$">GetDNSDomain</A>
        <LI><A HREF="CSimpleDNSClient.html#STDMETHOD(FindPrimaryServer)(VARIANT_*pvServerAddress)$">FindPrimaryServer</A>
    </UL>
    <LI>handle errors (try/catch in C++, On Error Resume Next in VBScript)
</UL>

<P><HR></P>

<A NAME="SAMPLE CODE (VBScript)">
<h3>SAMPLE CODE (VBScript)</h3>
</A>

<pre><font color="#990000"><tt>
    Dim oDNS
    ' Create object instance
    Set oDNS = CreateObject("Emmanuel.SimpleDNSClient.1")

    ' Declare output variable 
    Dim found_names

    ' Set the server address(es)
    oDNS.ServerAddresses = "99.99.99.99"

    ' Set separator for output variable (if multiple results are found)
    oDNS.Separator = ", "

    ' (1) Find IP address of hostname "www.microsoft.com" (Internet class, type A)
    On Error Resume Next
    oDNS.Resolve "www.microsoft.com", found_names, "C_IN", "T_A"
    If Err <> 0 Then
        MsgBox Err.Description
    Else
        ' Show resolved names (within dialog box)
        MsgBox "Found names:" & vbCrLf & vbCrLf & found_names
    End If

    ' (2) Find Email Servers for domain "microsoft.com"
    On Error Resume Next
    oDNS.GetEmailServers "microsoft.com", found_names
    If Err <> 0 Then
        MsgBox Err.Description
    Else
        ' Show resolved names (within dialog box)
        MsgBox "Found names:" & vbCrLf & vbCrLf & found_names
    End If
</tt></font></pre>


<P>Please refer to the test HTML files "<A HREF="TestSimpleDNSResolver.htm">TestSimpleDNSResolver.htm</A>"
and "<A HREF="TestDNSMagic.htm">TestDNSMagic.htm</A>" for a full VBSsript example (see GUI below).<P>

<p><CENTER><img src="SimpleDNSResolver.jpg" alt="Using the SimpleDNSResolver in Internet Explorer"></CENTER></p>



<P><HR></P>

<A NAME="IMPLEMENTATION">
<h3>IMPLEMENTATION</h3>
</A>

<P>

<UL>

<LI>Base API is the new <A HREF="http://msdn.microsoft.com/library/en-us/dns/dns_api_3fdx.asp">Windows 2000 DNS API</A><BR>
This component relies on the Windows DNS API provided by the Windows Platform SDK (August 2001).
The previous version was based on a porting of the BIND resolver library. Due to the high maintenance 
cost associated with this library, I decided to drop it when the DNS API came out. See the 
<A HREF="SimpleDNSResolver.html">Component online documentation</A> for more details.
</LI>

<LI>Automatic Conversion of reverse lookups (PTR)<BR>
If your request is a reverse (IP address-> IP name) lookup (type PTR), then the component 
silently converts request to a in-arpa format. That is, if you request a resolution of type 
PTR for IP address "207.46.230.229", then the component will send a resolution request for  
"229.230.46.207.in-addr.arpa" (PTR). The result will be "www.international.microsoft.com".
</LI>

<LI>Find Email Server automatically<BR>
The method <TT><B>GetEmailServers</B></TT> sends a request of type MX (Mail eXchanger) 
in order to find registered servers for a domain. It's only a shortcut for the 
<TT><B>Resolve</B></TT> method.
</LI>

<LI>Ignored Parameter: Resource Class<BR>
Due to limitations in the current Windows DNS API, the parameter 
<TT><B>BResourceClass</B></TT> is ignored by the <TT><B>Resolve</B></TT> method (you should always use the 
default class "C_IN" for Internet Class).
</LI>

<LI>Ignored Property: ServerAddresses<BR>
Due to limitations (bugs ?) in the current Windows DNS API, the property 
<TT><B>ServerAddresses</B></TT> is ignored by the <TT><B>Resolve</B></TT> method (the 
component always uses the local machine DNS configuration to find the DNS servers).
</LI>

</UL>
</P>

<P>
You can download the Microsoft Platform SDK from the Microsoft Web Site:<BR>
    <A HREF="http://www.microsoft.com/msdownload/platformsdk/sdkupdate">http://www.microsoft.com/msdownload/platformsdk/sdkupdate</A>
</P>
<P><HR></P>


<A NAME="TO DO LIST">
<h3>TO DO LIST</h3>
</A>

<UL>
    <LI>Test All DNS Resource Records (although all RR types are implemented, most of them couldn't be tested)
    <LI>Support DNS Security extensions (RFC 2535, "Domain Name System Security Extensions")
</UL>

<A NAME="REFERENCE DOCUMENTATION">
<P><HR></P>

<h3>REFERENCE DOCUMENTATION</h3>
</A>

<UL>
    <LI>Book: "DNS and BIND", by Paul Albitz & Cricket Liu, O'Reilly & Associates<BR>
        If you have to deal with DNS, I strongly recommend you to read this book: it's
        a very good presentation of DNS, from the protocol itself to the configuration tricks
        of a DNS server (using BIND).<BR>
        <A HREF="http://www.oreilly.com/catalog/dns3/index.html">http://www.oreilly.com/catalog/dns3/index.html</A>
    <LI>BIND (Berkeley Internet Name Domain), the reference implementation of the Domain Name System (DNS) protocols.<BR>
        <A HREF="http://www.isc.org/products/BIND">http://www.isc.org/products/BIND</A>
    <LI>A deprecated version of BIND, but who compiles and runs on Windows NT<BR>
        <A HREF="ftp://ftp.is.co.za/networking/ip/dns/bind/nt/kahn/ntbind497rel.zip">ftp://ftp.is.co.za/networking/ip/dns/bind/nt/kahn/ntbind497rel.zip</A>
    <LI>RFC 1034: "DOMAIN NAMES - CONCEPTS AND FACILITIES"<BR>
        <A HREF="http://www.ietf.org/rfc/rfc1034.txt">http://www.ietf.org/rfc/rfc1034.txt</A>
    <LI>RFC 1035: "DOMAIN NAMES - IMPLEMENTATION AND SPECIFICATION"<BR>
        <A HREF="http://www.ietf.org/rfc/rfc1035.txt">http://www.ietf.org/rfc/rfc1035.txt</A>
    <LI>RFC 0974: "Mail routing and the domain system"<BR>
        <A HREF="http://www.ietf.org/rfc/rfc0974.txt">http://www.ietf.org/rfc/rfc0974.txt</A>
    <LI>RFC 1712: "DNS Encoding of Geographical Location"<BR>
        <A HREF="http://www.ietf.org/rfc/rfc1712.txt">http://www.ietf.org/rfc/rfc1712.txt</A>
    <LI>RFC 2181: "Clarifications to the DNS Specification"<BR>
        <A HREF="http://www.ietf.org/rfc/rfc2181.txt">http://www.ietf.org/rfc/rfc2181.txt</A>
    <LI>RFC 2671: "Extension Mechanisms for DNS (EDNS0)"<BR>
        <A HREF="http://www.ietf.org/rfc/rfc2671.txt">http://www.ietf.org/rfc/rfc2671.txt</A>
    <LI>RFC 2535: "Domain Name System Security Extensions"<BR>
        <A HREF="http://www.ietf.org/rfc/rfc2535.txt">http://www.ietf.org/rfc/rfc2535.txt</A>
    <LI>RFC 2536: "DSA KEYs and SIGs in the Domain Name System (DNS)"<BR>
        <A HREF="http://www.ietf.org/rfc/rfc2536.txt">http://www.ietf.org/rfc/rfc2536.txt</A>
    <LI>RFC 2538: "Storing Certificates in the Domain Name System (DNS)"<BR>
        <A HREF="http://www.ietf.org/rfc/rfc2538.txt">http://www.ietf.org/rfc/rfc2538.txt</A>
    <LI>Microsoft Plaform SDK - Domain Name System - "DNS Start Page"<BR>
        <A HREF="http://msdn.microsoft.com/library/en-us/dns/dnsstartpage_2lgl.asp">http://msdn.microsoft.com/library/en-us/dns/dnsstartpage_2lgl.asp</A>
    <LI>Microsoft Plaform SDK - Domain Name System - "DNS Reference"<BR>
        <A HREF="http://msdn.microsoft.com/library/en-us/dns/dns_api_3fdx.asp">http://msdn.microsoft.com/library/en-us/dns/dns_api_3fdx.asp</A>
    <LI>Microsoft Plaform SDK - Domain Name System - "DNS Functions"<BR>
        <A HREF="http://msdn.microsoft.com/library/en-us/dns/dns_api_1wc3.asp">http://msdn.microsoft.com/library/en-us/dns/dns_api_1wc3.asp</A>
    <LI>Microsoft Plaform SDK - Domain Name System - "DNS Structures"<BR>
        <A HREF="http://msdn.microsoft.com/library/en-us/dns/dns_api_9837.asp">http://msdn.microsoft.com/library/en-us/dns/dns_api_9837.asp</A>
    <LI>Microsoft Plaform SDK - Download SDK<BR>
        <A HREF="http://www.microsoft.com/msdownload/platformsdk/sdkupdate">http://www.microsoft.com/msdownload/platformsdk/sdkupdate</A>
</UL>


<hr>

<h3>Download</h3>

<p>
  <A HREF="SimpleDNSResolver_src.zip">Download Article and Source Code</A> (202 KB).
</p>


<p>
  <A HREF="SimpleDNSResolverKit.exe">Download self-extracting kit</A> (191 KB).
</p>

<p><hr></p>

</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -