Ejemplo n.º 1
0
  private boolean connectSPPMon() {
    if (state == ConnectionEvent.CONNECTION_PENDING) {
      ExpCoordinator.print(
          new String("NCCPConnection(" + host + ", " + port + ").connect connection pending"), 0);
      while (state == ConnectionEvent.CONNECTION_PENDING) {
        try {
          Thread.sleep(500);
        } catch (java.lang.InterruptedException e) {
        }
      }
      return (isConnected());
    }

    state = ConnectionEvent.CONNECTION_PENDING;
    if (nonProxy != null) {
      try {
        nonProxy.connect();
      } catch (UnknownHostException e) {
        boolean rtn = informUserError("Don't know about host: " + host + ":" + e.getMessage());
        return rtn;
      } catch (SocketTimeoutException e) {
        boolean rtn = informUserError("Socket time out for " + host + ":" + e.getMessage());
        return rtn;
      } catch (IOException e) {
        boolean rtn = informUserError("Couldnt get I/O for " + host + ":" + e.getMessage());
        return rtn;
      }
    }
    return (isConnected());
  }
Ejemplo n.º 2
0
 public void sendMessage(NCCP.Message msg) {
   if (isClosed() || isFailed()) connect();
   if (isConnected()) {
     ExpCoordinator.printer.print("NCCPConnection::sendMessage", 5);
     if (proxy != null) proxy.sendMessage(msg, this);
     else {
       if (nonProxy != null) nonProxy.sendMessage(msg);
     }
   } else // still can't connect
   {
     pendingMessages.add(msg);
   }
 }
Ejemplo n.º 3
0
 public void close() {
   if (proxy != null && isConnected()) {
     proxy.closeConnection(this);
     setConnected(false);
   } else {
     if (nonProxy != null && isConnected()) {
       try {
         Thread.sleep(1000);
       } catch (java.lang.InterruptedException e2) {
       }
       nonProxy.close();
       setConnected(false);
     }
   }
 }
Ejemplo n.º 4
0
 public void flush() {
   if (nonProxy != null) nonProxy.flush();
 }