All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----java.lang.Thread | +----simu.net.Dispatcher
The Dispatcher class is spawned as a daemon thread by the Simulator Control Program (SCP) which listens for communication connection requests from remote objects on the network. When a TCP socket connection is made, the Dispatcher accepts it, creates a new ServerSocket on an anonymous port, gets the port number from the new ServerSocket and sends this port number to the remote object, after which it terminates the connection and proceeds to listen again for communication connection requests.
The new ServerSocket is passed to a SCPCommunicator, which listens for a subsequent connection request on the new port. This allows the dispatcher to listen for future communication requests while another thread (the SCPCommunicator in this case) processes pending requests.
public Dispatcher(sned TheSned, int ListenerPort, TextArea TextArea_StatusMessages)
Preconditions: None.
Postconditions: The listener daemon thread is spawned.
public void run()
All Packages Class Hierarchy This Package Previous Next Index