获取网站IP

getwebsite

                string strwebsite = this.txtwebsite.Text.Trim();
                textBox1.Text = "";
                IPHostEntry dnstoip = new IPHostEntry();
                dnstoip = Dns.GetHostEntry(strwebsite);

                IPScaner ipScaner = new IPScaner();
                ipScaner.DataPath = Application.StartupPath + "/IpWry.Dat"; 

                for (int i = 0; i < dnstoip.AddressList.Length; i++)
                {
                    string strIp = dnstoip.AddressList[i].ToString();
                    ipScaner.IP = strIp;
                    textBox1.AppendText(strwebsite + "对应的IP地址是" + strIp + " [" + ipScaner.IPLocation() + "]\r\n");
                }

posted on 2009-12-22 10:08  ★金★  阅读(407)  评论(0编辑  收藏  举报

导航