Пример #1
0
        internal override byte[] GetBytes()
        {
            DnsWriter bw = new DnsWriter();

            bw.Write(_flags);
            bw.Write(_ipAddress.GetAddressBytes());

            return(bw.GetBytes());
        }
Пример #2
0
        public byte[] GetMessage()
        {
            DnsWriter bw = new DnsWriter();

            _header.WriteBytes(bw);


            // Question
#if (MF)
            bw.Write((short)_questions.Length);
#else
            bw.Write((short)_questions.Count);
#endif

            // Answer, Authority, Additional
            // Those three records are not available in a query.

            bw.Write(new byte[]
            {
                0x0, 0x0,      // how many answers
                0x0, 0x0       // how many name server records
            });

            // Additional

#if (MF)
            bw.Write((short)_additionalRecords.Length);
#else
            bw.Write((short)_additionalRecords.Count);
#endif

            foreach (Question q in _questions)
            {
                q.Write(bw);
            }

            foreach (Additional a in _additionalRecords)
            {
                a.Write(bw);
            }

            return(bw.GetBytes());
        }