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

--
c-ares mailing list
c-ares@lists.haxx.se
https://lists.haxx.se/listinfo/c-ares

Reply via email to