1700478891
DnsServer china=new ChinaTopDnsServer();
1700478892
1700478893
//全球顶级域名服务器
1700478894
1700478895
DnsServer top=new TopDnsServer();
1700478896
1700478897
//定义查询路径
1700478898
1700478899
china.setUpperServer(top);
1700478900
1700478901
sh.setUpperServer(china);
1700478902
1700478903
//解析域名
1700478904
1700478905
System.out.println(”=====域名解析模拟器=====”);
1700478906
1700478907
while(true){
1700478908
1700478909
System.out.print(”\n请输入域名(输入N退出):”);
1700478910
1700478911
String domain=(new BufferedReader(new InputStreamReader
1700478912
1700478913
(System.in))).readLine();
1700478914
1700478915
if(domain.equalsIgnoreCase(“n”)){
1700478916
1700478917
return;
1700478918
1700478919
}
1700478920
1700478921
Recorder recorder=sh.resolve(domain);
1700478922
1700478923
System.out.println(”–-DNS服务器解析结果–-“);
1700478924
1700478925
System.out.println(recorder);
1700478926
1700478927
}
1700478928
1700478929
}
1700478930
1700478931
}
1700478932
1700478933
我们来模拟一下,运行结果如下所示:
1700478934
1700478935
=====域名解析模拟器=====
1700478936
1700478937
请输入域名(输入N退出):www.xxx.sh.cn
1700478938
1700478939
–-DNS服务器解析结果–-
1700478940
[
上一页 ]
[ :1.700478891e+09 ]
[
下一页 ]