如何在Vb.Net中获取IP地址的主机名? [英] How Do I Get Host Name Of An Ip Address In Vb.Net?

查看:119
本文介绍了如何在Vb.Net中获取IP地址的主机名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好



i无法获得主机名,我使用这个简单的vb.net代码(v2012)

这是google .com的IP地址,但是我得到了这个iad23s23-in-f2.1e100.net我想得到google.com。



i想创建一个简单的程序来查找具有解析IP范围的weburl的所有子域名。

(如acunetix web ..扫描仪)

我是怎么做到的?

谢谢

 <   pre     lang   =  vb >  
Imports System.Net

Public Class Form1


Private Sub Button1_Click(sender As Object,e As EventArgs)处理Button1.Click

RichTextBox1.AppendText(Dns.GetHostEntry(& quot; 74.125.228.194& quot;)。HostName .ToString)

结束S. ub
结束类< / pre > ;

解决方案

您无法获得IP地址的主机名,原因有两个:

1)它可能没有:例如,您正在使用的IP地址可能没有。每个域都连接到一个IP,但反过来不一定正确。

2)可以有多个域与一个IP地址关联。



但是,如果你能做到,你可以使用 DNS .GetHostEntry [ ^ ]

hello

i can't get host name , i use this simple code of vb.net (v2012)
this is google.com ip address, but i get this iad23s23-in-f2.1e100.net i want to get google.com.

i want to create i simple program to find all subdomain name of an weburl with resolve ip range.
(like acunetix web .. scanner)
how i do it?
thanks

<pre lang="vb">
Imports System.Net

Public Class Form1


    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        RichTextBox1.AppendText(Dns.GetHostEntry(&quot;74.125.228.194&quot;).HostName.ToString)

    End Sub
End Class</pre>

解决方案

You can't necessarily get "the host name" for an IP address, for two reasons:
1) It may not have one: the IP address you are using probably doesn't, for example. Each Domain is connected to one IP, but the reverse is not necessarily true.
2) There can be more than one domain associated with a single IP address.

However, if you can do it, you use DNS.GetHostEntry[^]


这篇关于如何在Vb.Net中获取IP地址的主机名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆