com.roeschter.jsl
Class TelnetEcho

java.lang.Object
  extended by java.lang.Thread
      extended by com.roeschter.jsl.TelnetEcho
All Implemented Interfaces:
Stopable, java.lang.Runnable

 class TelnetEcho
extends java.lang.Thread
implements Stopable

A simple example for a java service. This is a simple echoing Telnet Server. It accepts telnet connections on port 23 and echos back every character typed.


Nested Class Summary
(package private)  class TelnetEcho.Echo
          The worker thread.
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
(package private)  java.net.ServerSocket ss
          The server cocket which accepts connections
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
TelnetEcho()
           
 
Method Summary
static void confirmRunning()
           
static void cont()
           
 void debugDump(java.io.OutputStream out)
           
static void main(java.lang.String[] argv)
          The main method called when the service starts.
 void onServiceStop()
          Here the telnet server implements the Stopable interface On exit close the server cocket on port 23
static void paramtest(java.lang.String[] arg)
           
static void pause()
           
static int premain()
           
 void run()
          Open server socket and wait for incoming connections
 int timeToWait()
          Don't wait if onServiceStop does not return.
 void write(java.io.OutputStream out, java.lang.String s)
           
 void wrkDir(java.io.OutputStream out)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, 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, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ss

java.net.ServerSocket ss
The server cocket which accepts connections

Constructor Detail

TelnetEcho

TelnetEcho()
Method Detail

onServiceStop

public void onServiceStop()
Here the telnet server implements the Stopable interface On exit close the server cocket on port 23

Specified by:
onServiceStop in interface Stopable

timeToWait

public int timeToWait()
Don't wait if onServiceStop does not return. Terminate immediately.

Specified by:
timeToWait in interface Stopable

run

public void run()
Open server socket and wait for incoming connections

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

debugDump

public void debugDump(java.io.OutputStream out)

wrkDir

public void wrkDir(java.io.OutputStream out)

write

public void write(java.io.OutputStream out,
                  java.lang.String s)

paramtest

public static void paramtest(java.lang.String[] arg)

pause

public static void pause()

premain

public static int premain()

cont

public static void cont()

confirmRunning

public static void confirmRunning()

main

public static void main(java.lang.String[] argv)
                 throws java.lang.Exception
The main method called when the service starts.

Throws:
java.lang.Exception