making a query for mx records
Edgar Pettijohn
edgar at pettijohn-web.com
Sat Dec 11 17:38:16 CET 2021
On 12/11/21 10:11, Edgar Pettijohn via c-ares wrote:
> I'm planning on using c-ares for making mx record searches and
> possibly txt record searches. This is what I've tried, error checking
> and obvious stuff removed for clarity:
>
> int main() {
>
> unsigned char *buf;
>
> int buflen;
>
> struct ares_mx_reply *out;
>
> ares_library_init(ARES_LIB_INIT_ALL);
>
> ares_init(&channel);
>
> /* 1 = INTERNET, 15 = MX */
>
> ares_create_query(host, 1, 15, 0x1234, 1, &buf, &buflen, 0);
>
> wait_ares(channel);
>
> ares_parse_mx_reply(buf, buflen, &out);
>
> ...
>
> }
>
> this is where it errors out due to an empty response. I'm guessing
> I'm using the library wrong, but not sure.
>
>
> Thanks,
>
>
> Edgar
>
Fixed my problem by using ares_query() instead. I'm guessing the
ares_create_query() doesn't actually send the query perhaps its a lower
level function used within the library?
Thanks,
Edgar
More information about the c-ares
mailing list