Facemorph
Class Server

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

public class Server
extends java.lang.Thread

The Server class should run on the server in order to allow images to be saved to the server's disk and sent back to the client as a jpeg. Previously also used for saving Templates and as a HitCounter, not generally needed anymore.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  java.util.Vector connections
          The list of connections
protected  int count
          The number of connections to cycle around
static int DEFAULT_PORT
          The default port
static int HIT_COUNTER
          Specifies that you want to find or increment the HitCount.
protected  java.net.ServerSocket listen_socket
          The Scocket to listen with
static int OUTPUT_IMAGE
          Specifies that you want to send an image to the Server for saving
static int OUTPUT_TEMPLATE
          Specifies that you want to send a Template to the Server for saving
protected  int port
          The port that you are listening on
protected  Facemorph.Vulture vulture
          The vulture to clean up dead connections
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Server(int port, java.lang.String directory, java.lang.String outputDirURL)
          Create a ServerSocket to listen for connections and start the thread
 
Method Summary
static void fail(java.lang.Exception e, java.lang.String msg)
          Exit with an error message when an exception occurs
static void main(java.lang.String[] args)
          Start the server up, listening on an optionally specified port
 void run()
          The body of the server thread.
 
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
 

Field Detail

DEFAULT_PORT

public static final int DEFAULT_PORT
The default port

See Also:
Constant Field Values

OUTPUT_IMAGE

public static final int OUTPUT_IMAGE
Specifies that you want to send an image to the Server for saving

See Also:
Constant Field Values

OUTPUT_TEMPLATE

public static final int OUTPUT_TEMPLATE
Specifies that you want to send a Template to the Server for saving

See Also:
Constant Field Values

HIT_COUNTER

public static final int HIT_COUNTER
Specifies that you want to find or increment the HitCount.

See Also:
Constant Field Values

port

protected int port
The port that you are listening on


count

protected int count
The number of connections to cycle around


listen_socket

protected java.net.ServerSocket listen_socket
The Scocket to listen with


connections

protected final java.util.Vector connections
The list of connections


vulture

protected Facemorph.Vulture vulture
The vulture to clean up dead connections

Constructor Detail

Server

public Server(int port,
              java.lang.String directory,
              java.lang.String outputDirURL)
Create a ServerSocket to listen for connections and start the thread

Parameters:
port - The port to listen on
directory - The directory to save output to
outputDirURL -
Method Detail

fail

public static void fail(java.lang.Exception e,
                        java.lang.String msg)
Exit with an error message when an exception occurs

Parameters:
e - The Exception that caused the failure
msg - The error message

run

public void run()
The body of the server thread. Loop forever listening for and accepting connections from clients.

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

main

public static void main(java.lang.String[] args)
Start the server up, listening on an optionally specified port

Parameters:
args - The command line parameters.