为什么我获取的IP少一位数呢?
WebClient client = new WebClient();byte[] bytRecv = client.DownloadData("http://www.eyesoft.com.cn/ip.asp"); //下載數據
string str = System.Text.Encoding.GetEncoding("gb2312").GetString(bytRecv);
string r = @"(((\d{1,2})|(1\d{2})|(2[0-4]\d)|(25[0-5]))\.){3}((\d{1,2})|(1\d{2})|(2[0-4]\d)|(25[0-5]))";
string ip = System.Text.RegularExpressions.Regex.Match(str, r).ToString(); //提取信息
this.label6.Text = ip.ToString();
我获取的外网IP是60.222.148.12,而真实的IP是60.222.148.127