Hi Jeff,
Our implementations are slightly different in what they are trying to achieve. I was trying to iterate over the response from the DNS server to see if an A record was present (i.e. when the DNS server would have done the recursion and all of the CNAMEs for the query would be in the response). Your implementation is explicitly looking for the CNAME response to a query.
I have tried your implementation and queried a name which I know has a couple of CNAMEs in the response but my application was never able to resolve it. Maybe I'm using it wrong? I'm guessing that it is working for you?
Did you try my implementation? Does my implementation suit your needs?
Regards,
Chris