Ejemplo n.º 1
0
        ///<summary>
        ///</summary>
        public Response()
        {
            Questions = new List<Question>();
            Answers = new List<AnswerRR>();
            Authorities = new List<AuthorityRR>();
            Additionals = new List<AdditionalRR>();

            Server = new IPEndPoint(0, 0);
            Error = "";
            MessageSize = 0;
            TimeStamp = DateTime.Now;
            Header = new Header();
        }
Ejemplo n.º 2
0
        ///<summary>
        ///</summary>
        ///<param name="iPEndPoint"></param>
        ///<param name="data"></param>
        public Response(IPEndPoint iPEndPoint, byte[] data)
        {
            Error = "";
            Server = iPEndPoint;
            TimeStamp = DateTime.Now;
            MessageSize = data.Length;
            var rr = new RecordReader(data);

            Questions = new List<Question>();
            Answers = new List<AnswerRR>();
            Authorities = new List<AuthorityRR>();
            Additionals = new List<AdditionalRR>();

            Header = new Header(rr);

            for (var intI = 0; intI < Header.QDCOUNT; intI++)
            {
                Questions.Add(new Question(rr));
            }

            for (var intI = 0; intI < Header.ANCOUNT; intI++)
            {
                Answers.Add(new AnswerRR(rr));
            }

            for (var intI = 0; intI < Header.NSCOUNT; intI++)
            {
                Authorities.Add(new AuthorityRR(rr));
            }
            for (var intI = 0; intI < Header.ARCOUNT; intI++)
            {
                Additionals.Add(new AdditionalRR(rr));
            }
        }