检测DNS

作者: 大旺旺的弟弟小旺旺 | 来源:发表于2021-08-27 07:35 被阅读0次

使用网络地址获取主机名:

InetAddress.getByName(this.domain);获取主机地址

如果可以得到就说明是好的。
检测的代码

public class TestDns implements Runnable {
    private String hostName;
    private InetAddress inetAddr;

    public TestDns(String hostName) {
        this.hostName = hostName;
    }

    public void run() {
        try {
            set(InetAddress.getByName(this.hostName));
        } catch (UnknownHostException e) {
        }
    }

    public synchronized void set(InetAddress inetAddr2) {
        this.inetAddr = inetAddr2;
    }

    public synchronized InetAddress get() {
        return this.inetAddr;
    }
}

使用一个线程来等待

 TestDns dnsRes = new TestDns(hostname);
 Thread t = new Thread(dnsRes);
 t.start();
 t.join((long) timeout);
 InetAddress inetAddr = dnsRes.get();
 System.out.println(inetAddr);

相关文章

  • 解决github速度慢和图片不显示的问题

    1.打开Dns检测|Dns查询 - 站长工具[http://tool.chinaz.com/dns/] 2.在检测...

  • DNS检测

    http://ce.cloud.360.cn/

  • 检测DNS

    使用网络地址获取主机名: 如果可以得到就说明是好的。检测的代码 使用一个线程来等待

  • 解决 GitHub 无法访问的问题

    修改hosts1.打开Dns检测|Dns查询 - 站长工具2.在检测输入栏中输入github.com3.把检测列表...

  • github无法访问解决

    修改hosts1.打开Dns检测|Dns查询 - 站长工具2.在检测输入栏中输入github.com官网3.把检测...

  • 常用网站

    工具 DNS检测:http://tool.chinaz.com/dns 在线代码格式化:http://tool.c...

  • github访问缓慢的问题

    修改Host文件 打开Dns检测|Dns查询 - 站长工具 输入github地址github.comwww.git...

  • 威胁捕猎——域名服务(DNS)

    收集DNS数据会带来一些需要解决的数据收集和数据减少问题。DNS检测需要检测超出规范的名称查询,并能够在所有可能的...

  • github无法访问

    推荐方式: 根据域名查找对应延迟低的ip,然后修改host的域名,ip映射 Dns检测|Dns查询 - 站长工具 ...

  • IDN 检测相关资源

    IDN检测相关资源: https://cn.bing.com/search?q=DNS+IDN+deception...

网友评论

    本文标题:检测DNS

    本文链接:https://www.haomeiwen.com/subject/exoriltx.html