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
-
ComPointMail()
- Creats a ComPointMail.
-
ComPointMail(int, ComPointAddress)
- Creats an initiator or server ComPointMail.
-
accept()
- Waits for and returns a Responder ComPoint when a message arrives.
-
close()
- Closes the ComPointMail.
-
comPoint(int, ComPointAddress)
- Creates an Initiator or Server ComPointMail cast into ComPoint.
-
finalize()
- Finalizer.
-
getAddress()
- Returns the address.
-
getLocalAddress()
- Returns the local address.
-
getProtocol()
- Returns the protocol.
-
getRemoteAddress()
- Returns the peer address.
-
getType()
- Returns the type.
-
init()
- Initializes the ComPointMail module.
-
isInitialized()
- Check whether the module is initialized.
-
read()
- Waits for and returns a message received on the ComPoint.
-
write(Serializable)
- Sends the message through the ComPoint.
ComPointMail
public ComPointMail()
- Creats a ComPointMail.
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.
init
public static void init() throws ComPointException
- Initializes the ComPointMail module.
- Throws: ComPointException
- if error while opening socket.
isInitialized
public static boolean isInitialized()
- Check whether the module is initialized.
- Returns:
- true if and only if fully initialized;
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.
close
public void close() throws ComPointException
- Closes the ComPointMail.
- Throws: ComPointException
- if type is invalid or encountered
an error while closing the socket.
finalize
protected void finalize()
- Finalizer.
- Overrides:
- finalize in class Object
getProtocol
public String getProtocol()
- Returns the protocol.
getType
public int getType()
- Returns the type.
getAddress
public ComPointAddress getAddress()
- Returns the address.
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)
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 ...
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.
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.
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