LumiSoft.Net.Dns.Client.Dns_Client.ParseMxRecord C# (CSharp) Method

ParseMxRecord() private method

Parses MX record.
private ParseMxRecord ( byte reply, int &offset, int ttl ) : MX_Record
reply byte
offset int
ttl int TTL(time to live) value in seconds.
return MX_Record
        private MX_Record ParseMxRecord(byte[] reply,ref int offset,int ttl)
        {
            /* RFC 1035	3.3.9. MX RDATA format

            +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
            |                  PREFERENCE                   |
            +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
            /                   EXCHANGE                    /
            /                                               /
            +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

            where:

            PREFERENCE
                A 16 bit integer which specifies the preference given to
                this RR among others at the same owner.  Lower values
                are preferred.

            EXCHANGE
                A <domain-name> which specifies a host willing to act as
                a mail exchange for the owner name.
            */

            int pref = reply[offset++] << 8 | reply[offset++];

            string name = "";
            if(GetQName(reply,ref offset,ref name)){
                return new MX_Record(pref,name,ttl);
            }

            return null;
        }