在线求 判断IP能不能连网 - .NET技术 / C#

状态: 未解决 - 阅读:1456 - 提问时间: 2012-03-28 20:49:15 - 引源:CSDN论坛 - 校对:[女]
关键字:,dotNet论坛

   



  WebProxy proxyObject = new WebProxy("221.130.18.157", 80);//str为IP地址 port为端口

  string rl;

  HttpWebRequest Request = (HttpWebRequest)WebRequest.Create("http://house60.3g.qq.com/g/s?");
  Request.Proxy = proxyObject;


  HttpWebResponse Response = (HttpWebResponse)Request.GetResponse();


  Stream resStream = Response.GetResponseStream();

  StreamReader sr = new StreamReader(resStream, Encoding.UTF8);
  Encoding code = Encoding.GetEncoding("UTF-8");







  StringBuilder sb = new StringBuilder();

  while ((rl = sr.ReadLine()) != null)
  {
  sb.Append(rl);
  }



  richTextBox1.Text = "";

  string strhtml2 = sb.ToString();//抓取得到的源网页


  string he1 = strhtml2.ToString();
  richTextBox1.Text = stripHtml(he1);//去除html标签后得到的源网页

  Match TitleMatch1 = Regex.Match(he1, "<title>([^<]*)</title>", RegexOptions.IgnoreCase | RegexOptions.Multiline);//获取网页的标题
  //Thread.Sleep(500);
  label1.Text = i.ToString();




怎么判断我这个IP地址能不能连网,如果不能连网我再做其他操作
 
相关问题
 

 
- 最新问答
最新问题
最近完成的问题
热点标签云
 
业界新闻资讯