Class Connection

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--Connection
All Implemented Interfaces:
java.lang.Runnable

public class Connection
extends java.lang.Thread

Name: Connection
Desc: This object is instantiated when a Server object accepts an incomming connection from a nsjc client. When that happens this object attempts to retrieve the test information being sent from the nsjc client. The information comes over in three data packets, retrieved by three readLine method calls into a Buffered Reader object. When the three lines are received then the connection is closed, the results are written to the command file, and the thread ends

Note that the Connection object won't start processing the information from the nsjc client until it is started. Because this object extends Thread, you have to call the 'run' method to start it's reading of the data.

author: viaggi@nietzsche.net


Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Connection(java.net.Socket client_socket, nsjsd nsjParent, java.lang.String strHost)
          Name: Connection
          Desc: This function is the constructor and the only way, currently, that you can initialize the internal instance variables to run the object.
 
Method Summary
 void run()
          Name: run
          Desc: This function is provided because this object implements the runnable interface.
 
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
 

Constructor Detail

Connection

public Connection(java.net.Socket client_socket,
                  nsjsd nsjParent,
                  java.lang.String strHost)
Name: Connection
Desc: This function is the constructor and the only way, currently, that you can initialize the internal instance variables to run the object. This object accepts the socket that the client is connecting on, the nsjsd parent, and the name of the host to add to the string written to the command file. The reason the host is being passed in is in-case you have an alias setup, in which case attempting to identify the host by way of the Socket will give the wrong host info.

Parameters:
client_socket - --> Socket, the socket the client is connecting on.
nsjParent - --> the nsjsd parent object
strHost - --> String, the name of the host to write to the command file
Method Detail

run

public void run()
Name: run
Desc: This function is provided because this object implements the runnable interface. This means that this function is called when the thread is started as a separate process. It essentially collects the information that the client is sending to this server and turns the stream into a string that will report the status to the command file.

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