tags:

views:

280

answers:

1

i need to resolve a hostname using a specific DNS server like you would in nslookup

C:\>nslookup hotname 192.100.10.10
Server:  UnKnown
Address:  192.100.10.10

Name:    hostname.host
Address:  192.100.10.14

But ofcourse in return i dont just want the address i want all the values for Server, Address, Name and Address

I have looked at the System.Net.Dns Class but that only gives me the Resolved IP Address and dosent let me select the DNS Server of my choosing

If any one has done this before and you can help me with this. it would be great :D

Thanks in Advanced

Edit:

Found One for C# : http://www.simpledns.com/dns-client-lib.aspx

Here is a Snipet of my code just for some entertainment

//Buy him Cookies and Strippers
using JHSoftware;
A: 

I still dont have an answer for C++ but here is the one for C#

var Options = new JHSoftware.DnsClient.RequestOptions();
Options.DnsServers = new System.Net.IPAddress[] { 
           System.Net.IPAddress.Parse("1.1.1.1"), 
           System.Net.IPAddress.Parse("2.2.2.2") };
var IPs = JHSoftware.DnsClient.LookupHost("www.simpledns.com", 
                                          JHSoftware.DnsClient.IPVersion.IPv4, 
                                          Options);
foreach(var IP in IPs)
{
   Console.WriteLine(IP.ToString());
}

The above is using JHSoftware.dll and the code is copied from there to help others, the link is as below:

http://www.simpledns.com/dns-client-lib.aspx

Shahmir Javaid