public sealed class WindowsDnsResolverClient DNS resolver queries sent to one chosen DNS server, not the computer's configured resolvers (DnsQueryEx with a server list).
Remarks
Queries go over the network only: the resolver cache, the hosts file, LLMNR and NetBIOS are not used, and the name is not extended with DNS suffixes. Windows chooses UDP or TCP and its retry timeouts; a server that does not answer is AdministrationErrorCategory.Unavailable (native 1460). The query runs off the caller's thread; cancellation before it starts prevents it, and once it starts its actual result is returned. Requires Windows x64.
Constructors
WindowsDnsResolverClient
public WindowsDnsResolverClient(IPAddress server) Creates a client that queries server on the DNS port (53), for example a domain controller.
Methods
QueryAsync
public Task<DnsResolution> QueryAsync(string name, DnsRecordType type, CancellationToken cancellationToken = default) Queries the server for records of one type. Name errors and other response codes are results.
ReverseLookupAsync
public Task<DnsResolution> ReverseLookupAsync(IPAddress address, CancellationToken cancellationToken = default) Queries the server for the PTR records of an address (reverse lookup).
ReverseLookupName
public static string ReverseLookupName(IPAddress address) The reverse lookup name of an address: 4.3.2.1.in-addr.arpa for 1.2.3.4, and the reversed nibbles under ip6.arpa for an IPv6 address.
Remarks
An IPv4-mapped IPv6 address uses its IPv4 name.