Class EmulatedNodeServer

java.lang.Object
  extended by java.lang.Thread
      extended by EmulatedNodeServer
All Implemented Interfaces:
java.lang.Runnable

public class EmulatedNodeServer
extends java.lang.Thread

   
 In a seperate thread, this class listens to incoming messages from neighbors and stores the data received
 


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
EmulatedNodeServer(java.net.DatagramSocket socket)
          Creates a new EmulatedNodeServer
 
Method Summary
 java.net.DatagramPacket getPacket()
          Gets the first packet stored
 boolean hasPackets()
          Tests if there are more packets stored
 void run()
          This starts the server
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EmulatedNodeServer

public EmulatedNodeServer(java.net.DatagramSocket socket)
Creates a new EmulatedNodeServer

Parameters:
socket - The UDP socket to listen on
Method Detail

run

public void run()
This starts the server

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

hasPackets

public boolean hasPackets()
Tests if there are more packets stored

Returns:
True if there are more packets stored in memory

getPacket

public java.net.DatagramPacket getPacket()
Gets the first packet stored

Returns:
The first packet stored