net.clackrouter.application
Class TCPRedirector

java.lang.Object
  extended by java.lang.Thread
      extended by net.clackrouter.application.ClackApplication
          extended by net.clackrouter.application.TCPRedirector
All Implemented Interfaces:
java.lang.Runnable, Alarm

public class TCPRedirector
extends ClackApplication

A Clack application that uses a Clack host to proxy to a real Internet host, thus redirecting the TCP traffic.

The redirect effect is achieved using two sockets. One is a socket running on the clack router and another is a real Java socket connected to the host that the redirector is proxying. Any data received in the Clack socket is sent to the real host using the Java socket, and any data received using the java socket is sent back to the client using the Clack socket. This effectively allows us to pretend like a real-host is inside our Clack network.


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
TCPRedirector()
           
 
Method Summary
 void application_main(java.lang.String[] args)
          Abstract "main method" to be implemented by sub-class
 java.lang.String getDescription()
          Returns a very brief (single line) description of the application
 
Methods inherited from class net.clackrouter.application.ClackApplication
alert, configure, createTCPSocket, createUDPSocket, getAppName, getRouter, getTime, notifyAlarm, pause, print, run, setAlarm, setShell
 
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TCPRedirector

public TCPRedirector()
Method Detail

application_main

public void application_main(java.lang.String[] args)
Description copied from class: ClackApplication
Abstract "main method" to be implemented by sub-class

Specified by:
application_main in class ClackApplication
Parameters:
args - the application arguments

getDescription

public java.lang.String getDescription()
Description copied from class: ClackApplication
Returns a very brief (single line) description of the application

Specified by:
getDescription in class ClackApplication