DNS lookup for MX records 
Author Message
 DNS lookup for MX records

Hi,

I'd like to know how I can do a DNS-lookup to get the MX records. I
prefer raw code and no controls to do this.
To David Whitman. If you're already pasting your default reply for
this then don't :-). I think some example source code to lookup MX
records using your SocketTools would be more helpful.

Thanks!



Wed, 18 Jun 1902 08:00:00 GMT  
 DNS lookup for MX records


Quote:
>I'd like to know how I can do a DNS-lookup to get the MX records. I
>prefer raw code and no controls to do this.
>To David Whitman. If you're already pasting your default reply for
>this then don't :-). I think some example source code to lookup MX
>records using your SocketTools would be more helpful.

Ok.... you ask ....  you get  ...  :)

#include <stdio.h>
#include <cstools.h>

#pragma comment(lib, "csdnsl32")

int main(int argc, char* argv[])
{
    HCLIENT hClient;

    if (!DnsInitialize(CSTOOLS_LICENSE_KEY, 0L))
    {
        fprintf(stderr, "Unable to initialize SocketTools library\n");
        exit(1);
    }

    if ((hClient = DnsConnect(NULL, 0, 60, 4)) == INVALID_CLIENT)
    {
        fprintf(stderr, "Unable to determine default nameservers\n");
        exit(1);
    }

    while (--argc)
    {
        char *pszHostName = *++argv;
        char szExchange[256];
        int nPreference;
        int cchExchange;

        cchExchange = DnsGetMailExchange(hClient,
                                         pszHostName,
                                         &nPreference,
                                         szExchange,
                                         sizeof(szExchange));

        if (cchExchange == DNS_ERROR)
        {
            fprintf(stderr, "%s: no mail exchange for this domain\n",
                            pszHostName);
        }
        else
        {
            printf("%s: %s\n", pszHostName, szExchange);
        }
    }

    DnsDisconnect(hClient);
    DnsUninitialize();
    return 0;

Quote:
}

David
www.catalyst.com


Wed, 18 Jun 1902 08:00:00 GMT  
 DNS lookup for MX records

Quote:


>>I'd like to know how I can do a DNS-lookup to get the MX records. I
>>prefer raw code and no controls to do this.
>>To David Whitman. If you're already pasting your default reply for
>>this then don't :-). I think some example source code to lookup MX
>>records using your SocketTools would be more helpful.
> Ok.... you ask ....  you get  ...  :)
> #include <stdio.h>
> #include <cstools.h>

Ack!  That's C!!!

WE DON'T SPEAK YOUR CRAZY MOON LANGUAGE!!!!

--



Wed, 18 Jun 1902 08:00:00 GMT  
 DNS lookup for MX records


Quote:


>>I'd like to know how I can do a DNS-lookup to get the MX records. I
>>prefer raw code and no controls to do this.
>>To David Whitman. If you're already pasting your default reply for
>>this then don't :-). I think some example source code to lookup MX
>>records using your SocketTools would be more helpful.

>Ok.... you ask ....  you get  ...  :)

>#include <stdio.h>
>#include <cstools.h>

I've always thought this was a VB ng, but I could be wrong though...

Does anyone know how to port this C-code to VB? Or any other (VB!!)
approaches for getting the MX records?

Thanks!



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. DNS lookup for MX records

2. DNS lookup MX records

3. DNS MX lookup

4. Trying to do DNS lookup and reverse DNS lookup

5. MX Record Lookup?

6. REQ: Help with DNS query for MX records (DNSQuery)

7. DNS MX-record query

8. snipits showing how to get MX record from DNS server

9. how to Get the all of the MX records from the DNS

10. DNS MX-records

11. Get MX Records from a DNS

12. DNS MX records

 

 
Powered by phpBB® Forum Software