DNS Functions (MS_DNS) > Alphabetical List of Functions > ms_dns_query

ms_dns_query

Example: ms_dns_query DNS Functions (MS_DNS)

Resolves the IP address of a host.

char *ms_dns_query( char *transaction,  char *dnsserverURL, [char*  IPversion], [char *query_host,] [char *local_address,] LAST ); 

transaction A transaction name for this step in quotes. To instruct VuGen not to create a transaction for this step, use a NULL string, "".
dnsserverURL The IP address of the DNS server as a URL: "URL=dns://server_ip:port" (The default port is 53)
IPversion The IP version. The value is 4 or 6.
For example, "IPversion=6"
The default is 4.
query_host The hostname to resolve:"QueryHost=hostname"
local_address A local address for IP spoofing:"LocalAddr=local_ip:port"
LAST A marker indicating the end of the argument list.

The ms_dns_query function resolves the IP address(es) of the specified host name, using a Domain Name Service (DNS). This function does not automatically add the domain to the hostname, you need to include it explicitly.

The ms_dns_query function returns a pointer to a list of IP addresses for the specified hostname, delimited by NULL characters. The first IP address corresponds to the first address returned in the DNS query results. To advance to the next result in the list, use ms_dns_nextresult.

A script that calls ms_dns_query must have an #include "mic_socket.h" statement. Before the first call to ms_dns_query, invoke lr_load_dll ( "micsocket.dll" );.

Return Values

If this function succeeds, it returns a pointer to a list of IP addresses for the specified hostname, delimited by NULL characters. Otherwise, it returns LR_FAIL.

Parameterization

All arguments of this function of the type char, can be parameterized with standard parameterization.