ts.mail
Class AbstractMailServer
java.lang.Object
|
+--ts.mail.AbstractMailServer
- Direct Known Subclasses:
- Pop3Agent, SmtpAgent
- public abstract class AbstractMailServer
- extends java.lang.Object
This class is an immutable abstract mail server. It could
represent a MTA (Mail Transport Agent) or a server for retrieving
mail (e.g. POP3 server). The class is an abstract frontend to a
Mail server and implements general properties for such a server.
- Version:
- $Id: AbstractMailServer.java,v 1.8 2000/03/24 17:18:24 hauk Exp $
- Author:
- Jan-Henrik Haukeland <hauk@tildeslash.com>
|
Constructor Summary |
AbstractMailServer(java.lang.String aHost,
int aPort)
Initializes the object with values for the mail server |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SO_TIMEOUT
public static final int SO_TIMEOUT
myMailServer
protected java.net.InetAddress myMailServer
- Mail server host Internet address
myMailServerPortNumber
protected int myMailServerPortNumber
- Mail server port number
AbstractMailServer
public AbstractMailServer(java.lang.String aHost,
int aPort)
throws java.net.UnknownHostException
- Initializes the object with values for the mail server
- Parameters:
aHost - - The mail server host. The value can either be a
machine name, such as "mail.online.no", or a string
representing its IP address, such as "193.212.1.34".aPort - - The server portnumber- Throws:
java.net.UnknownHostException - Is thrown if no IP address
for the host could be found
getMailServer
public java.lang.String getMailServer()
- Returns:
- Returns the mail servers IP address as "%d.%d.%d.%d"
getMailServerName
public java.lang.String getMailServerName()
- Returns:
- Returns the mail servers hostname
getMailServerPortNumber
public int getMailServerPortNumber()
- Returns:
- Returns the mail server's port number
openConnection
protected java.net.Socket openConnection()
throws java.io.IOException
- Connects to the server and return a connected socket
- Returns:
- a connected socket
closeConnection
protected void closeConnection()
throws java.io.IOException
- Close the connection to the mail server
getInputStream
protected java.io.InputStream getInputStream()
throws java.io.IOException
- Returns an inputstream from the connected socket
- Returns:
- an inputstream from the mail server
- Throws:
java.io.IOException - if not connected
getOutputStream
protected java.io.OutputStream getOutputStream()
throws java.io.IOException
- Returns an outputstream to the mail server for writing
- Returns:
- an outputstream to the mail server
- Throws:
java.io.IOException - if not connected