复制代码 代码如下:
QQWry.NET.QQWryLocator qqWry = new QQWry.NET.QQWryLocator("qqwry.dat");//初始化数据库文件,并获得IP记录数,通过Count可以获得
QQWry.NET.IPLocation ip = qqWry.Query("120.67.217.7"); //查询一个IP地址
Console.WriteLine("{0} {1} {2}", ip.IP, ip.Country, ip.Local);
复制代码 代码如下:
Stopwatch stopwatch = new Stopwatch();
List<string> ips = new List<string> { "218.5.3.128", "120.67.217.7", "125.78.67.175", "220.250.64.23", "218.5.3.128", "120.67.217.7", "125.78.67.175", "220.250.64.23" };
stopwatch.Start();
for (int i = 0; i < 100; i++)
{
foreach (string item in ips)
{
ip = qqWry.Query(item);
// Console.WriteLine("{0} {1} {2}", ip.IP, ip.Country, ip.Local);
}
}
stopwatch.Stop();
Console.WriteLine("QQWryLocator 花了{0} ms", stopwatch.ElapsedMilliseconds);
stopwatch.Reset();
stopwatch.Start();
for (int i = 0; i < 100; i++)
{
foreach (string item in ips)
{
string s = IPLocation.IPLocation.IPLocate("qqwry.dat", item);
// Console.WriteLine(s);
}
}
stopwatch.Stop();
Console.WriteLine("IPLocation 花了{0} ms", stopwatch.ElapsedMilliseconds);
新闻热点
疑难解答
图片精选