public static DnsResponse From(byte[] buffer, int length) { if (buffer == null || length <= 0) { return null; } DnsQuery query = new DnsQuery(string.Empty, Types.A); query.data = buffer; query.length = length; query.ReadResponse(); return new DnsResponse { AdditionalRecords = query.Response.AdditionalRecords, Answers = query.Response.Answers, AuthorativeAnswer = query.Response.AuthorativeAnswer, Authorities = query.Response.Authorities, IsTruncated = query.Response.IsTruncated, QueryID = query.Response.QueryID, ResponseCode = query.Response.ResponseCode, RecursionRequested = query.Response.RecursionRequested, RecursionAvailable = query.Response.RecursionAvailable, Questions = query.Response.Questions }; }