Exemplo 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);
    }
  }
Exemplo n.º 2
0
  /**
   * @return
   * @throws IOException
   */
  private ServerConfiguration populate(Properties p) throws IOException {
    config.setPort(Commons.getIntPropertyValue(p, "vgw.port", VRC_PORT));
    config.setPoolSize(Commons.getIntPropertyValue(p, "vgw.pool.size", VRC_POOL_SIZE));
    config.setReadBufferSize(
        Commons.getIntPropertyValue(p, "VRC_READ_BUFFER_SIZE", VRC_READ_BUFFER_SIZE));
    config.setReceiveBufferSize(
        Commons.getIntPropertyValue(p, "VRC_RECEIVE_BUFFER_SIZE", VRC_RECEIVE_BUFFER_SIZE));
    config.setSendBufferSize(
        Commons.getIntPropertyValue(p, "VRC_SEND_BUFFER_SIZE", VRC_SEND_BUFFER_SIZE));
    config.setClientBeginUDPPort(
        Commons.getIntPropertyValue(p, "VRC_CLIENT_BEGIN_UDP_PORT", VRC_CLIENT_BEGIN_UDP_PORT));
    config.setClientPoolSize(
        Commons.getIntPropertyValue(p, "VRC_CLIENT_POOL_SIZE", VRC_CLIENT_POOL_SIZE));
    config.setClientPortSize(
        Commons.getIntPropertyValue(p, "VRC_CLIENT_PORT_SIZE", VRC_CLIENT_PORT_SIZE));
    config.setDatagramHeader(
        Commons.getStringPropertyValue(p, "VRC_DATAGRAM_HEADER", VRC_DATAGRAM_HEADER));
    config.setDatagramEnd(Commons.getStringPropertyValue(p, "VRC_DATAGRAM_END", VRC_DATAGRAM_END));
    config.setLocalIpAddress(
        Commons.getStringPropertyValue(p, "vgw.localipaddress", VRC_LOCALIPADDRESS));
    //		config.setRegionId(Commons
    //				.getStringPropertyValue(p, "VRC_REGIONID", ""));
    //		config.setRtspAddr(Commons.getStringPropertyValue(p, "VRC_RTSP_ADDR",
    //				""));
    //
    //		config.setBwIp(Commons.getStringPropertyValue(p, "bgw.ip", ""));
    //		config.setBwPort(Commons.getIntPropertyValue(p, "bgw.port", 0));
    //		config.setInterval(Commons.getIntPropertyValue(p,
    //				"bgw.heartbeat.interval", 6000));
    config.setVodTimeout(Commons.getIntPropertyValue(p, "vod.timeout", 86400));
    //		config.setDooptionTime(Commons.getIntPropertyValue(p, "dooption.time",
    //				20000));

    config.setCtasIp(Commons.getStringPropertyValue(p, "ctas.ip", "127.0.0.1"));
    config.setCtasPort(Commons.getIntPropertyValue(p, "ctas.port", 20000));
    config.setSource(source);
    config.setForwardTime(Commons.getIntPropertyValue(p, "vod.forward.time", 60));
    config.setThreadTime(Commons.getIntPropertyValue(p, "vod.thread.time", 5));
    config.setTelnetip(Commons.getStringPropertyValue(p, "vlc.telnet.ip", "192.168.100.56"));
    config.setTelnetport(Commons.getIntPropertyValue(p, "vlc.telnet.port", 5000));
    config.setTelnetpasswd(Commons.getStringPropertyValue(p, "vlc.telnet.password", "bbcv"));

    config.setReportType(false);

    config.setSMserverIP(Commons.getStringPropertyValue(p, "sm.server.ip", "192.168.100.11"));
    config.setSMserverPORT(Commons.getIntPropertyValue(p, "sm.server.port", 20909));

    return config;
  }