All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class semper.comm.ComPointMail

java.lang.Object
   |
   +----semper.comm.ComPointMail

public class ComPointMail
extends Object
implements ComPoint
Implements the ComPoint interface for the Mail protocol.

Version:
beta-4, 12.8.96
Author:
Mehdi Nassehi

Constructor Index

 o ComPointMail()
Creats a ComPointMail.
 o ComPointMail(int, ComPointAddress)
Creats an initiator or server ComPointMail.

Method Index

 o accept()
Waits for and returns a Responder ComPoint when a message arrives.
 o close()
Closes the ComPointMail.
 o comPoint(int, ComPointAddress)
Creates an Initiator or Server ComPointMail cast into ComPoint.
 o finalize()
Finalizer.
 o getAddress()
Returns the address.
 o getLocalAddress()
Returns the local address.
 o getProtocol()
Returns the protocol.
 o getRemoteAddress()
Returns the peer address.
 o getType()
Returns the type.
 o init()
Initializes the ComPointMail module.
 o isInitialized()
Check whether the module is initialized.
 o read()
Waits for and returns a message received on the ComPoint.
 o write(Serializable)
Sends the message through the ComPoint.

Constructors

 o ComPointMail
 public ComPointMail()
Creats a ComPointMail.

 o ComPointMail
 public ComPointMail(int type,
                     ComPointAddress address) throws ComPointException
Creats an initiator or server ComPointMail.

Parameters:
type - type of ComPointMail to be created
address - remote address
Throws: ComPointException
if type is invalid, class not initialized, or the socket cannot be opened.

Methods

 o init
 public static void init() throws ComPointException
Initializes the ComPointMail module.

Throws: ComPointException
if error while opening socket.
 o isInitialized
 public static boolean isInitialized()
Check whether the module is initialized.

Returns:
true if and only if fully initialized;
 o comPoint
 public ComPoint comPoint(int type,
                          ComPointAddress address) throws ComPointException
Creates an Initiator or Server ComPointMail cast into ComPoint.

Parameters:
type - type of ComPointMail to be created
address - if the type is server, the local address; otherwise, the remote address.
Returns:
comPoint ComPoint
Throws: ComPointException
if type is invalid, the module is not initiated, or the socket cannot be opened.
 o close
 public void close() throws ComPointException
Closes the ComPointMail.

Throws: ComPointException
if type is invalid or encountered an error while closing the socket.
 o finalize
 protected void finalize()
Finalizer.

Overrides:
finalize in class Object
 o getProtocol
 public String getProtocol()
Returns the protocol.

 o getType
 public int getType()
Returns the type.

 o getAddress
 public ComPointAddress getAddress()
Returns the address.

 o getLocalAddress
 public ComPointAddress getLocalAddress()
Returns the local address. Note: we always return the canonical IP address for the host; this should be the most portable (e.g when sending a compointaddress from one host to another)

 o getRemoteAddress
 public ComPointAddress getRemoteAddress()
Returns the peer address. Note: we always return the canonical IP address for the host; this should be the most portable (e.g when sending a compointaddress from one host to another) Note: the remote address is not garantueed to be the correct one ! firewalls/proxies can result in a address which is not really the address of the original originator and doesn't allow a callback. In most cases though such situations anyway don't allow any callback ...

 o write
 public synchronized void write(Serializable message) throws ComPointException
Sends the message through the ComPoint. The ComPoint may be of the type initiator or responder.

Parameters:
message - message to be sent.
Throws: ComPointException
if the type is invalid, the module is not initiated, or encountered an error while externalizing the message.
 o read
 public synchronized Serializable read() throws ComPointException
Waits for and returns a message received on the ComPoint. The ComPoint may be of type Responder or initiator.

Throws: ComPointException
if the type is invalid, the module is not initiated, or encountered an error while internalizing the message.
 o accept
 public synchronized ComPoint accept() throws ComPointException
Waits for and returns a Responder ComPoint when a message arrives. Must be invoked on a ComPoint of type Server.

Throws: ComPointException
if the type is invalid, the module is not initiated, or encountered an error while accepting a new socket.

All Packages  Class Hierarchy  This Package  Previous  Next  Index