Mail from ILUG-BOM list (Non-Digest Mode)
_______________________________________________

Abhijeet said:

> I tried something like this,
>
>    char *answer=(char *)malloc(1024);
>    int anslen;
>    res_query("test.com", C_IN, T_MX,(u_char *) answer, anslen);
>
> anslen has the value 0. and answer is blank.


The first thing I notice about your code is that you are passing anslen
by value, so don't expect its value to change on return from the
function.

Now, according to the documentation of the res_query function, you are
supposed to supply anslen as the number of bytes you want returned into
answer, which in your case would be 1024.  If you set it to 0, then you
will get zero bytes returned in answer.

You also need to have your host.conf and resolv.conf set up correctly.

HTH.

Philip

PS: I have never tried this

_______________________________________________
Website: http://www.ilug-bom.org.in/ilug
Linuxers mailing list
[EMAIL PROTECTED]
http://ilug-bom.org.in/mailman/listinfo/linuxers

Reply via email to