Query method
ReplyMsg = Query ( Name [, Type] [, Class]
)
| Name |
String |
Domain name for which to retrieve records |
| Type |
Short, optional |
Type of records to retrieve. Defaults to hexDnsTypeA |
| Class |
Short, optional |
Class of records to retrieve. Defaults to hexDnsClassIN, which you may
never need override. |
| ReplyMsg |
Message |
Response from server if the query succeeded. Includes the original
question plus any records returned. |
The Query method provides a simple means of retrieving resource
records from a DNS server. Just specify a domain name and record type (from the HexDnsType
constants), and Query will do the rest. Behind the scenes, it creates Question and Message
objects, fills them in properly, and sends off the query to the server specified by RemoteAddr. If the query succeeds, Query
returns the response as a Message object.
If you want to additional control over your queries, use QueryEx.
Be sure to check the Error property after
every call to Query. Furthermore, even if Error
indicates success from a network communication standpoint, the returned Message
object may contain an error code from the server in its ResponseCode
property. In general, Query does only the most basic communication tasks
and leaves the error checking and retries to you.
The Lookup object provides another layer of
abstraction for convenient A (address) and PTR (reverse address) lookups. The LookUp and ReverseLookUp methods are
implemented using a Connection object and Query.
|