Source code: TransportProtocol.java

index |  41 lines | javadoc ]

package nl.west.aaa;

import java.io.*;

/**
 * Classes implementing this interface can send and
 * receive messages.
 *
 * The transportprotocol should be listening to incoming 
 * connections when specified to do so. This is protocol 
 * and implementation dependant.
 *
 * @see Identifier
 */
public interface TransportProtocol
{

    /**
     * Send the message to the identifier.
     * If an error has occured an IOException will be thrown.
     * No thrown exception may indicate that the transportprotocol
     * has handled the message correctly.
     * The signaling of receipt of the message
     * by the receiver (transport level acnoledgement) 
     * is protocol dependant.
     */
    public void sendMessage(byte[] data,Identifier id)
        throws IOException;
    
    /**
     * Listen for connections and pass them to the AAAUnit
     * useing the handleIncoming() method of the AAAUnit.
     * If a receiver was specified earlier, this value overwrites
     * the old value and no more incoming messages should
     * be sent to the orriginal receiver.
     * If the given receiver is null no more incoming messages
     * should be passed to the receiver.
     */
    public void startListening(AAAUnit receiver);
    
}


Arthur <arthur@ch.twi.tudelft.nl> http://ch.twi.tudelft.nl/~arthur/
2002-05-27