Holger's
Java API

com.antelmann.net
Interface NetConnection

All Superinterfaces:
Closeable
All Known Implementing Classes:
SecureConnection, SocketConnection, SSLSocketConnection

public interface NetConnection
extends Closeable

A NetConnection provides a convenient way to communicate with a remote process. All objects sent must implement Serializable.

Author:
Holger Antelmann
See Also:
NetConnectionServer, NetConnectionHandler, ConnectionDispatcher

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

Method Detail

getHandshake

Handshake getHandshake()
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.


sendMessage

void sendMessage(Object message)
                 throws IOException
sends an object over the connection

Throws:
IOException

readMessage

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

Throws:
IOException
ClassNotFoundException

getSocket

Socket getSocket()
returns the underlying Socket of this connection


isActive

boolean isActive()
returns whether this NetConnection is currently active



(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads