nl.west.aaa
Class UDPTransport

java.lang.Object
  |
  +--nl.west.aaa.UDPTransport
Direct Known Subclasses:
RadiusTransport

public class UDPTransport
extends java.lang.Object
implements TransportProtocol


Field Summary
protected  AAAUnit receiver
           
protected  int sendPort
           
protected  java.net.DatagramSocket sendSocket
           
 
Constructor Summary
protected UDPTransport()
          Provided for subclasses handling their own socket management.
  UDPTransport(int listenPort, int sendPort)
          Initialize transport over UDP.
 
Method Summary
protected  void addSocketListener(java.net.DatagramSocket socket)
          Start listening on the socket for new messages.
 void sendMessage(byte[] data, Identifier id)
          Send the given data to the destination.
 void startListening(AAAUnit receiver)
          Listen for connections and pass them to the AAAUnit useing the handleIncoming() method of the AAAUnit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

receiver

protected AAAUnit receiver

sendSocket

protected java.net.DatagramSocket sendSocket

sendPort

protected int sendPort
Constructor Detail

UDPTransport

public UDPTransport(int listenPort,
                    int sendPort)
             throws java.net.SocketException
Initialize transport over UDP. listenPort is the port that is listened on, sendPort is the port UDP messages are sent to.

UDPTransport

protected UDPTransport()
Provided for subclasses handling their own socket management.
Method Detail

addSocketListener

protected void addSocketListener(java.net.DatagramSocket socket)
Start listening on the socket for new messages. Any messages will be passed to the receiver (AAAUnit).

sendMessage

public void sendMessage(byte[] data,
                        Identifier id)
                 throws java.io.IOException
Send the given data to the destination. The UDP packet is sent to the sendPort port on the receiver.
Specified by:
sendMessage in interface TransportProtocol

startListening

public void startListening(AAAUnit receiver)
Listen for connections and pass them to the AAAUnit useing the handleIncoming() method of the AAAUnit.
Specified by:
startListening in interface TransportProtocol



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