编写代码

    private static final String DNS = "dns://";
    public static void main(String[] args) throws Exception{
        Hashtable<String, String> env = new Hashtable<String, String>();
        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.dns.DnsContextFactory");
        env.put(Context.PROVIDER_URL, DNS);

        InitialDirContext ctx = new InitialDirContext(env);
        Attributes attributes = ctx.getAttributes("qq.com", new String[]{"MX"});
        System.out.println(attributes );
    }

结果如下
clipboard.png


洛洛木南2
6 声望1 粉丝

下一篇 »
gitlab使用