Class simu.net.Dispatcher
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class simu.net.Dispatcher

java.lang.Object
   |
   +----java.lang.Thread
           |
           +----simu.net.Dispatcher

public class Dispatcher
extends Thread
Version:
1.0 16-Mar-97
Author:
Andre Campeau

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.

See Also:
SCPCommunicator

Constructor Index

 o Dispatcher(sned, int, TextArea)
This Dispatcher constructor spawns a listener daemon thread.

Method Index

 o run()
The run method contains the code that will be run by the Dispatcher thread.

Constructors

 o Dispatcher
  public Dispatcher(sned TheSned,
                    int ListenerPort,
                    TextArea TextArea_StatusMessages)
This Dispatcher constructor spawns a listener daemon thread.

Preconditions: None.

Postconditions: The listener daemon thread is spawned.

Parameters:
TheSned - A pointer to the Simulated Network Element Database (SNED).
ListenerPort - The well-known port that the Dispatcher thread will listen on.
TextArea_StatusMessages - The Dispatcher will occasionally print status messages to the SCP status messages text area, so a pointer to this is required.

Methods

 o run
  public void run()
The run method contains the code that will be run by the Dispatcher thread.
Overrides:
run in class Thread

All Packages  Class Hierarchy  This Package  Previous  Next  Index