aleph.comm.tcp
Class Connection

java.lang.Object
  |
  +--aleph.comm.tcp.Connection
Direct Known Subclasses:
AutoConnection, TCPConnection

public abstract class Connection
extends java.lang.Object

A Connection is a stream socket. A listener thread handles input, and a send method handles output.


Field Summary
protected static Counter messagesSent
           
 
Constructor Summary
Connection()
           
 
Method Summary
 void close()
          Clean me up.
abstract  void flush()
          Flush output stream.
abstract  boolean ping()
          Ping output stream.
protected abstract  Message receive()
          Blocking method that pulls in the next message.
abstract  void send(Message message)
          Send'em a message.
 void start()
          Start thread to process incoming messages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

messagesSent

protected static Counter messagesSent
Constructor Detail

Connection

public Connection()
Method Detail

start

public void start()
Start thread to process incoming messages. Must be called after calling the constructor.

close

public void close()
Clean me up.

flush

public abstract void flush()
                    throws java.io.InterruptedIOException
Flush output stream.

ping

public abstract boolean ping()
Ping output stream.

receive

protected abstract Message receive()
                            throws java.io.IOException
Blocking method that pulls in the next message.

send

public abstract void send(Message message)
                   throws java.io.IOException
Send'em a message.
Parameters:
message - what to send
Throws:
java.io.IOException - something's wrong