Class Response
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
timedOutboolSets 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
serverIPEndPointIPEndPoint of the DNS server that responded to the query.
databyte[]byte array of the response data.
Exceptions
- ArgumentNullException
serverordatais null.
Properties
Additional
Gets the list of additional resource records.
public List<AdditionalResourceRecord> Additional { get; }
Property Value
Answers
Gets the list of answer resource records.
public List<AnswerResourceRecord> Answers { get; }
Property Value
Authorities
Gets the list of authority resource records.
public List<AuthorityResourceRecord> Authorities { get; }
Property Value
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
MessageSize
Gets or sets the size of the DNS message in bytes.
public int MessageSize { get; set; }
Property Value
Questions
Gets the list of question resource records.
public List<Question> Questions { get; }
Property Value
ResourceRecords
Gets the collection of all resource records, including answers, authorities, and additional records.
public IEnumerable<ResourceRecord> ResourceRecords { get; }
Property Value
Server
Gets the IP endpoint of the DNS server that provided the response.
public IPEndPoint Server { get; }
Property Value
TimeStamp
Gets the UTC timestamp indicating when the response was received or created.
public DateTime TimeStamp { get; }
Property Value
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
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
TThe type of DNS records to retrieve, derived from Record.