submission.Demo
Class UDPEchoServer

java.lang.Object
  extended byjava.lang.Thread
      extended bysimnet.Application
          extended bysubmission.Demo.EchoServer
              extended bysubmission.Demo.UDPEchoServer
All Implemented Interfaces:
Pluggable, PlugoutListener, java.lang.Runnable, SimnetWindowListener

public class UDPEchoServer
extends EchoServer
implements Pluggable

An example of an EchoServer implemented with UDP.


Nested Class Summary
private  class UDPEchoServer.UDPEchoServerThread
          The thread that does all of the work for an open port.
 
Field Summary
protected  java.util.Hashtable sessions
           
 
Fields inherited from class submission.Demo.EchoServer
prefix
 
Fields inherited from class simnet.Application
appid, appstart, node, NODE_ID, pid, random, sim
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
UDPEchoServer()
           
 
Method Summary
 void close(int port)
          Close a server on a port
 void customInit()
          This is where an application can do any application-specific initializeation it requires.
 void open(int port)
          Open server on a new port
 boolean prePlugout(java.lang.Object replacement)
          To cleanup, just clear out the sessions table (the worker threads clean themselves up).
 void status()
          Print a status report
 
Methods inherited from class submission.Demo.EchoServer
close, open, setPrefix
 
Methods inherited from class simnet.Application
closeWindow, finalize, getTitleString, initialize, plugoutNotification, printout, printout, processWindowCommand, rawOut, run, window
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sessions

protected java.util.Hashtable sessions
Constructor Detail

UDPEchoServer

public UDPEchoServer()
Method Detail

customInit

public void customInit()
Description copied from class: Application
This is where an application can do any application-specific initializeation it requires.

Overrides:
customInit in class Application

open

public void open(int port)
Open server on a new port

Specified by:
open in class EchoServer

close

public void close(int port)
Close a server on a port

Specified by:
close in class EchoServer

status

public void status()
Print a status report

Specified by:
status in class EchoServer

prePlugout

public boolean prePlugout(java.lang.Object replacement)
To cleanup, just clear out the sessions table (the worker threads clean themselves up).

Specified by:
prePlugout in interface Pluggable
Returns:
if this object can now be removed (was the operation sucessful)