且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

VB网站的2008 IP地址?

更新时间:2023-12-02 15:13:52

实际上,您拥有的代码很好,您似乎已经完成了. 前三行似乎工作正常(尽管GetHostByName已过时).然后,请第二三行来解析失败的IP地址.您需要的是:
Actually the code you have is good you just seem to have over done it.
The first 3 lines seem to work fine (Although GetHostByName is obsolete). Then you ask the second 3 lines to resolve an IP address which fails. All you need is:
Dim hostname As IPHostEntry = Dns.GetHostEntry(TextBox3.Text)
Dim ip As IPAddress() = hostname.AddressList
TextBox3.Text = ip(0).ToString()