Esempio n. 1
0
  private void prepClient() {
    // Create stream buffer reader/writer
    LogUtil.log(this.clientId, "Initiating links to redirect stream buffers...");
    // try {

    // Create stream buffer reader/writer
    this.serverReader = new ServerReader(this);
    this.serverWriter = new ServerWriter(this);
    this.serverReader.start();
    this.serverWriter.start();

    LogUtil.log(this.clientId, "Waiting to prept Client Handle...");
    while (this.isReady()) {
      LogUtil.log(this.clientId, "Waiting...");
      TimeUtil.skipToMyLou(0.2);
    }
    LogUtil.log(this.clientId, "Synced!!");

    // clientOut = new PrintWriter(client.getOutputStream(), true);
    // clientIn  = new BufferedReader(new InputStreamReader(client.getInputStream()));
    //        } catch (IOException e) {
    //            System.err.println("Could not Prepare ClientHandler: " + client.toString());
    //        }
    LogUtil.log(this.clientId, "Initiated links to redirect stream buffers");
  }
Esempio n. 2
0
  @Override
  public void run() {

    Thread.currentThread().setName("ClientHandler:" + this.clientId);

    try {
      LogUtil.log(clientId, "Welcoming new Client on Server Base");
      LogUtil.log(clientId, "Client: " + client);
      // Create stream buffer reader/writer
      // prepClient();
      // Register client
      // registerClient();
      // Wait for requested task
      // receiveClientRequest();
      // Close Client
      // closeClient();
      // Unregister Client
      // unregisterClient();
      // Create stream buffer reader/writer
      prepClient();
      // Register with client
      this.registerClient();
      // Let reader/writer run till shutdown
      while (isRunning()) {
        TimeUtil.skipToMyLou(2);
      }
      // Close Client
      closeClient();
    } catch (RegisterClientException e) {
      e.printStackTrace(System.err);
    } catch (UnexpectedIPCResponseException e) {
      e.printStackTrace(System.err);
    } catch (IOException e) {
      e.printStackTrace(System.err);
    }
    //
    System.out.println(this.server);
    System.out.print("\n\n");
  }