Esempio n. 1
0
  /**
   * 设置启动服务参数
   *
   * @param args 启动命令行参数
   * @throws Exception 如果读取应用配置文件时发生异常
   */
  private void init(String[] args) throws Exception {
    try {
      initLog4j();

      Properties p = loadConfigFile();
      populate(p);
      logger.info(TCPServer.config.toString());

      String telnetIP = config.getTelnetip();
      int telnetPort = config.getTelnetport();
      String telnetpassword = config.getTelnetpasswd();
      telnet.setIp(telnetIP);
      telnet.setPort(telnetPort);
      telnet.Connect();
      while (!telnet.isConnect()) {
        telnet.Connect();
        //				logger.info("连接成功?=============="+telnet.isConnect());
      }
      if (telnet.isConnect()) {
        logger.info("连接VLC服务器成功,发送认证命令。。。。。。");
        telnet.sendCommand(telnetpassword);
      }
    } catch (Exception e) {
      throw new Exception("加载配置文件异常", e);
    }
  }
Esempio n. 2
0
 private void reset(String[] args) throws Exception {
   Map controllerMap = TCPServer.getControllerList();
   if (!controllerMap.isEmpty()) {
     Set controllerSet = controllerMap.keySet();
     Iterator controllerIterator = controllerSet.iterator();
     while (controllerIterator.hasNext()) {
       Controller ctrl = (Controller) controllerMap.get(controllerIterator.next());
       telnet.sendCommand("del " + ctrl.getId());
       TCPServer.getControllerList().remove(ctrl.getSessionId());
     }
   }
 }