Share this page

# Example: ms_dns_query

In the following example, the ms_dns_query resolves the IP address for a server.

        #include "mic_socket.h"

        char *results = NULL;
        int   rescnt  = 0;

        lr_load_dll ( "micsocket.dll" );

        lr_save_string("123.456.789.012","DnsServer");    // Set DNS server IP Address
        lr_save_string("myserver.mydomain", "Hostname");  // Set hostname to resolve

        // Perform DNS Query
        results = (char *) ms_dns_query("DnsQuery",
                "URL=dns://{DnsServer}",
                "IPversion=6",
                "QueryHost={Hostname}",
                 LAST);

        // List the results
        while (*results) {
            rescnt++;
            lr_log_message(
                lr_eval_string("(%d) IP address for {Hostname} is %s"),
                rescnt,
                results);
            results = (char *) ms_dns_nextresult(results);
        }

Tips to improve your search results... VuGen Function Reference Version 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: