Table of Contents

Class Response

Namespace
Ubiety.Dns.Core
Assembly
Ubiety.Dns.Core.dll

Represents a DNS response received from a DNS server. This class contains details about the DNS response, such as questions, answers, authorities, additional records, and metadata.

public class Response
Inheritance
Response
Inherited Members

Remarks

Initializes a new instance of the Response class.

Constructors

Response()

Initializes a new instance of the Response class.

public Response()

Response(bool)

Represents a DNS response received from a DNS server. This class contains details about the DNS response, such as questions, answers, authorities, additional records, and metadata.

public Response(bool timedOut)

Parameters

timedOut bool

Sets whether the response timed out or not.

Remarks

Initializes a new instance of the Response class.

Response(IPEndPoint, byte[])

Initializes a new instance of the Response class.

public Response(IPEndPoint server, byte[] data)

Parameters

server IPEndPoint

IPEndPoint of the DNS server that responded to the query.

data byte[]

byte array of the response data.

Exceptions

ArgumentNullException

server or data is null.

Properties

Additional

Gets the list of additional resource records.

public List<AdditionalResourceRecord> Additional { get; }

Property Value

List<AdditionalResourceRecord>

Answers

Gets the list of answer resource records.

public List<AnswerResourceRecord> Answers { get; }

Property Value

List<AnswerResourceRecord>

Authorities

Gets the list of authority resource records.

public List<AuthorityResourceRecord> Authorities { get; }

Property Value

List<AuthorityResourceRecord>

Header

Gets the header information of the DNS response. The header contains metadata such as ID, flags, question count, and record counts associated with the DNS response.

public Header Header { get; }

Property Value

Header

MessageSize

Gets or sets the size of the DNS message in bytes.

public int MessageSize { get; set; }

Property Value

int

Questions

Gets the list of question resource records.

public List<Question> Questions { get; }

Property Value

List<Question>

ResourceRecords

Gets the collection of all resource records, including answers, authorities, and additional records.

public IEnumerable<ResourceRecord> ResourceRecords { get; }

Property Value

IEnumerable<ResourceRecord>

Server

Gets the IP endpoint of the DNS server that provided the response.

public IPEndPoint Server { get; }

Property Value

IPEndPoint

TimeStamp

Gets the UTC timestamp indicating when the response was received or created.

public DateTime TimeStamp { get; }

Property Value

DateTime

Remarks

This is UTC so that record expiry stays correct across a daylight saving transition.

TimedOut

Gets a value indicating whether the DNS response timed out.

public bool TimedOut { get; }

Property Value

bool

Methods

GetRecords<T>()

Retrieves a list of DNS records of a specific type from the response.

public List<T> GetRecords<T>() where T : Record

Returns

List<T>

A list of DNS records of the specified type found in the response.

Type Parameters

T

The type of DNS records to retrieve, derived from Record.