Esempio n. 1
0
  private void createContext(String host, int port, String comm, String socketType) {
    myFrame.setTitle("Set One  - " + host);

    if (context != null) {
      context.destroy();
    }
    try {
      context = new SnmpContextPool(host, port, socketType);
      context.setCommunity(comm);
    } catch (java.io.IOException exc) {
      lmessage.setText("IOException: " + exc.getMessage());
      lmessage.setBackground(Color.red);
    }
  }
Esempio n. 2
0
  private void createContext(String host, String portStr, String comm, String socketType) {
    int port = SnmpContextBasisFace.DEFAULT_PORT;
    try {
      port = Integer.valueOf(portStr).intValue();
    } catch (NumberFormatException exc) {
    }

    if (context != null) {
      context.destroy();
      // context.dumpContexts("destroy");
    }
    try {
      context = new SnmpContextPool(host, port, socketType);
      context.setCommunity(comm);
      // context.dumpContexts("create:");
      System.out.println(context);
    } catch (java.io.IOException exc) {
      exc.printStackTrace();
    }
  }