smtp_relayserver
Class SMTPHostFinder

java.lang.Object
  |
  +--smtp_relayserver.SMTPHostFinder

public class SMTPHostFinder
extends java.lang.Object

This class allows you to find for passed host name the associated SMTP host either as IP address or as host name.

Copyright (C) 1998 Valentin Koch

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


Constructor Summary
SMTPHostFinder(java.lang.String nameServer1, java.lang.String nameServer2)
          Creates a new SMTPHostFinder.
 
Method Summary
 java.net.InetAddress getAddress(java.lang.String remoteHost)
           
 java.lang.String getHostName(java.lang.String remoteHost)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SMTPHostFinder

public SMTPHostFinder(java.lang.String nameServer1,
                      java.lang.String nameServer2)
Creates a new SMTPHostFinder.
Parameters:
nameServer1 - The first domain name server which should be used
nameServer2 - The second domain name server which should be used
Method Detail

getAddress

public java.net.InetAddress getAddress(java.lang.String remoteHost)
                                throws java.net.UnknownHostException,
                                       TimeoutException,
                                       NameServerException
Parameters:
remoteHost - The host name of the domain zone where the expected SMTP host is
Returns:
The IP Address of the SMTP host as InetAddress
Throws:
java.net.UnknownHostException - The required host is unknown
TimeoutException - The name server did not respond in the given time
NameServerException - The name server had an error

getHostName

public java.lang.String getHostName(java.lang.String remoteHost)
                             throws java.net.UnknownHostException,
                                    TimeoutException,
                                    NameServerException
Parameters:
remoteHost - The host name of the domain zone where the expected SMTP host is
Returns:
The host name of the SMTP host as String
Throws:
java.net.UnknownHostException - The required host is unknown
TimeoutException - The name server did not respond in the given time
NameServerException - The name server had an error