com.roeschter.jsl
Class TelnetEcho

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--com.roeschter.jsl.TelnetEcho
All Implemented Interfaces:
java.lang.Runnable, Stopable

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.
 
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
(package private) TelnetEcho()
           
 
Method Summary
static void cont()
           
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 pause()
           
 void run()
          Open server socket and wait for incoming connections
 int timeToWait()
          Don't wait if onServiceStop does not return.
 
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, 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

pause

public static void pause()

cont

public static void cont()

main

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

java.lang.Exception