Class com.tdac.mail.SocketConnection
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.tdac.mail.SocketConnection

java.lang.Object
   |
   +----com.tdac.mail.SocketConnection

public class SocketConnection
extends Object
This base class defines a socket connection to a server.
Version:
1.0, 11/11/96
Author:
Timothy D. A. Cox

Constructor Index

 o SocketConnection()
Construct an SocketConnection object.

Method Index

 o connect(String, int, boolean)
Connect to a server on a port.
 o disconnect()
Disconnect the socket from the server
 o finalize()
Finalize the connection.
 o read()
Test routine used to read a single line from the server
 o readLine(boolean)
 o send(String)
Test routine used to send a string to the server
 o writeLine(String)

Constructors

 o SocketConnection
  public SocketConnection()
Construct an SocketConnection object.

Methods

 o finalize
  public void finalize()
Finalize the connection. This will invoke the 'disconnect' method if the connection is still alive.
Overrides:
finalize in class Object
 o connect
  public synchronized String connect(String server,
                                     int port,
                                     boolean greeting) throws ExceptionMailConnection
Connect to a server on a port. Will setup the private stream objects and optionally read the mail server greeting.
Parameters:
server - the mail server name (eg. mail.domain.com)
port - the socket port to connect on (eg. 110 or 143)
Returns:
the mail server greeting string
 o disconnect
  public void disconnect() throws ExceptionMailConnection
Disconnect the socket from the server
 o readLine
  public String readLine(boolean block) throws IOException
 o writeLine
  public String writeLine(String io) throws IOException
 o send
  public void send(String s) throws ExceptionMailConnection
Test routine used to send a string to the server
Parameters:
s - the string command to be written
 o read
  public String read() throws ExceptionMailConnection
Test routine used to read a single line from the server
Returns:
single line server response

All Packages  Class Hierarchy  This Package  Previous  Next  Index