Show / Hide Table of Contents

Interface IDnsClient

Client interface to a DNS server.

Inherited Members
IDisposable.Dispose()
IResolver.ResolveAsync(Message, CancellationToken)
Namespace: Makaretu.Dns
Assembly: Makaretu.Dns.Unicast.dll
Syntax
public interface IDnsClient : IDisposable, IResolver

Properties

| Improve this Doc View Source

ThrowResponseError

Determines if an exception is thrown when a response contains an error.

Declaration
bool ThrowResponseError { get; set; }
Property Value
Type Description
Boolean

Defaults to true.

Remarks

When set, an exception is thrown if the response's Status is not NoError or is considered invalid for the request.

Methods

| Improve this Doc View Source

NextQueryId()

Get the next ID for a query message.

Declaration
ushort NextQueryId()
Returns
Type Description
UInt16

The next Id

Remarks

This is thread safe.

| Improve this Doc View Source

QueryAsync(DomainName, DnsType, CancellationToken)

Send a DNS query with the specified name and resource record type.

Declaration
Task<Message> QueryAsync(DomainName name, DnsType rtype, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
DomainName name

A domain name.

DnsType rtype

A resource record type.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<Message>

A task that represents the asynchronous operation. The task's value contains the response Message.

Remarks

Creates a query Message and then calls QueryAsync(Message, CancellationToken).

| Improve this Doc View Source

QueryAsync(Message, CancellationToken)

Send a DNS query with the specified message.

Declaration
Task<Message> QueryAsync(Message request, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
Message request

A Message containing a Question.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<Message>

A task that represents the asynchronous operation. The task's value contains the response Message.

Remarks

The request is sent with UDP. If no response is received (or is truncated) in Timeout, then it is resent via TCP.

Some home routers have issues with IPv6, so IPv4 servers are tried first.

Exceptions
Type Condition
IOException

When the DNS server returns error status or no response.

| Improve this Doc View Source

ResolveAsync(DomainName, CancellationToken)

Get the IP addresses for the specified name.

Declaration
Task<IEnumerable<IPAddress>> ResolveAsync(DomainName name, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
DomainName name

A domain name to resolve.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<IEnumerable<IPAddress>>

A task that represents the asynchronous operation. The task's value contains the IPAddress sequence for the name.

| Improve this Doc View Source

ResolveAsync(IPAddress, CancellationToken)

Reverse query for an IP address.

Declaration
Task<DomainName> ResolveAsync(IPAddress address, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
IPAddress address

An IP address with an AddressFamily of InterNetwork or InterNetworkV6.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<DomainName>

A task that represents the asynchronous operation. The task's value is the domain name of address.

Remarks

Performs a reverse lookup with a PTR. The response contains the name(s) of the address.

| Improve this Doc View Source

SecureQueryAsync(DomainName, DnsType, CancellationToken)

Send a DNSSEC query with the specified name and resource record type.

Declaration
Task<Message> SecureQueryAsync(DomainName name, DnsType rtype, CancellationToken cancel = default(CancellationToken))
Parameters
Type Name Description
DomainName name

A domain name.

DnsType rtype

A resource record type.

CancellationToken cancel

Is used to stop the task. When cancelled, the TaskCanceledException is raised.

Returns
Type Description
Task<Message>

A task that represents the asynchronous operation. The task's value contains the response Message.

Remarks

Creates a secure query Message and then calls QueryAsync(Message, CancellationToken).

See Also
UseDnsSecurity()

See Also

DnsClientBase
  • Improve this Doc
  • View Source
Back to top Generated by DocFX