org.jscience.net
Interface NetConnection

All Known Implementing Classes:
SecureConnection, SocketConnection, SSLSocketConnection

public interface NetConnection

A NetConnection provides a convenient way to communicate with a remote process. All objects used must be serializable.

See Also:
NetConnectionServer, NetConnectionHandler, ConnectionDispatcher

Method Summary
 void close()
          closes the NetConnection
 java.lang.Object getSignature()
          returns the identification type object for this connection; this signature is the same on both sides of the connection.
 java.net.Socket getSocket()
          returns the underlying Socket of this connection
 boolean isActive()
          returns whether this NetConnection is currently active
 java.lang.Object readMessage()
          reads an object from the connection (operation blocks until object is read)
 void sendMessage(java.lang.Object message)
          sends an object over the connection
 

Method Detail

getSignature

java.lang.Object getSignature()
returns the identification type object for this connection; this signature is the same on both sides of the connection. Note that this object requires the equals(Object obj) method to work after serialization/de-serialization; Strings work just fine.

Returns:
DOCUMENT ME!

sendMessage

void sendMessage(java.lang.Object message)
                 throws java.io.IOException
sends an object over the connection

Parameters:
message - DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!

readMessage

java.lang.Object readMessage()
                             throws java.io.IOException,
                                    java.lang.ClassNotFoundException
reads an object from the connection (operation blocks until object is read)

Returns:
DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!
java.lang.ClassNotFoundException - DOCUMENT ME!

getSocket

java.net.Socket getSocket()
returns the underlying Socket of this connection

Returns:
DOCUMENT ME!

isActive

boolean isActive()
returns whether this NetConnection is currently active

Returns:
DOCUMENT ME!

close

void close()
closes the NetConnection