[SNMP4J] How To stop TestAgent

Mark Gorokhov mark.gorokhov at comtechmobile.com
Thu Mar 29 23:35:31 CEST 2007


Find the code in the TestAgent.main()

      while (true) {
        try {
          Thread.sleep(1000);
        }
        catch (InterruptedException ex1) {
          break;
        }
      }

and replace it to

      try {
        BufferedReader in = new BufferedReader(new
InputStreamReader(System.in));
        while (true) {
          // Prompt to "err" to show it in red in Eclipse console:
          System.err.print("Type 'exit' to exit> ");
          String str = in.readLine();
          if ("exit".equals(str)) {
            System.exit(0);
          }
        }
      } catch (IOException e) {
      }

BTW, Eclipse console allows entering "exit" to stop TestAgent.

-mg



More information about the SNMP4J mailing list