当前位置: 技术问答>java相关
Java DNS 解析問題 ... 請高手幫忙 !!
来源: 互联网 发布时间:2017-04-02
本文导语: 如何根據域名得到 DNS 解析結果的 MX 節點的完整機器名 ? 舉例來說 : 知道一個郵件 xxx@sohu.com , 得到域名 sohu.com 現在如何知道 sohu.com 域中 mailserver 的機器名 ? | /* * Copyright (C) Th...
如何根據域名得到 DNS 解析結果的 MX 節點的完整機器名 ?
舉例來說 :
知道一個郵件 xxx@sohu.com , 得到域名 sohu.com
現在如何知道 sohu.com 域中 mailserver 的機器名 ?
舉例來說 :
知道一個郵件 xxx@sohu.com , 得到域名 sohu.com
現在如何知道 sohu.com 域中 mailserver 的機器名 ?
|
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package org.apache.james.dnsserver;
import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.phoenix.Block;
import org.xbill.DNS.*;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.*;
/**
* @version 1.0.0, 18/06/2000
* @author Serge Knystautas
*/
public class DNSServer
extends AbstractLogEnabled
implements Block, Configurable, Initializable,
org.apache.james.services.DNSServer {
private Resolver resolver;
private Cache cache;
private byte dnsCredibility;
private Collection servers = new Vector();
public void configure( final Configuration configuration )
throws ConfigurationException {
// Get this servers that this block will use for lookups
final Configuration serversConfiguration = configuration.getChild( "servers" );
final Configuration[] serverConfigurations =
serversConfiguration.getChildren( "server" );
for ( int i = 0; i
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package org.apache.james.dnsserver;
import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.phoenix.Block;
import org.xbill.DNS.*;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.*;
/**
* @version 1.0.0, 18/06/2000
* @author Serge Knystautas
*/
public class DNSServer
extends AbstractLogEnabled
implements Block, Configurable, Initializable,
org.apache.james.services.DNSServer {
private Resolver resolver;
private Cache cache;
private byte dnsCredibility;
private Collection servers = new Vector();
public void configure( final Configuration configuration )
throws ConfigurationException {
// Get this servers that this block will use for lookups
final Configuration serversConfiguration = configuration.getChild( "servers" );
final Configuration[] serverConfigurations =
serversConfiguration.getChildren( "server" );
for ( int i = 0; i