用于 C# 和 C++ 的 nslookup使用特定服务器解析主机
我需要使用特定的 DNS 服务器解析主机名,就像在 nslookup 中一样
C:\>nslookup hotname 192.100.10.10
Server: UnKnown
Address: 192.100.10.10
Name: hostname.host
Address: 192.100.10.14
,但当然,作为回报,我不仅仅想要地址,我想要 Server
、Address
的所有值code>、Name
和 Address
我已经查看了 System.Net.Dns
类,但它只提供了解析的 IP 地址,而没有提供不要让我选择我选择的 DNS 服务器
如果有人以前这样做过并且你可以帮助我。
编辑:
找到一个 C# 版本:http://www. simpledns.com/dns-client-lib.aspx
这是我的代码片段,仅供娱乐
//Buy him Cookies and Strippers
using JHSoftware;
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 of course in return I don't 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 doesn't let me select the DNS Server of my choosing
If any one has done this before and you can help me with this.
Edit:
Found One for C# : http://www.simpledns.com/dns-client-lib.aspx
Here is a snippet of my code just for some entertainment
//Buy him Cookies and Strippers
using JHSoftware;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我仍然没有 C++ 的答案,但这是 C# 的答案
如下:
上面使用的是 JHSoftware.dll,代码是从那里复制的以帮助其他人,链接 simpledns.com/dns-client-lib.aspx" rel="nofollow noreferrer">http://www.simpledns.com/dns-client-lib.aspx
I still dont have an answer for C++ but here is the one for C#
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