public bool init(String configFilePath, int maxConnections = 0) { var MyIni = new Common.IniFile(configFilePath); _port = Int32.Parse(MyIni.Read("port", "JSON")); _addrToConnect = MyIni.Read("addrToConnect", "JSON"); return(true); }
public bool execute(string[] arguments) { //EBS_LOG_TRACE; if (arguments.Length > 1) { //EBS_LOG_CONSOLE("PricingManager " << PricingManager_VERSION); return(false); } // Command Line: ./PricingManager <CONFIG_FILE> (-c) if (arguments.Length != 1) { //EBS_LOG_CONSOLE("Usage: ./PricingManager <CONFIG_FILE> (-c)\n\t-c\tUse consule mode") return(false); } String configFilePath = arguments[0]; if (!File.Exists(configFilePath)) { return(false); } var MyIni = new Common.IniFile(configFilePath); _port = Int32.Parse(MyIni.Read("port", "JSON")); _addrToConnect = MyIni.Read("addrToConnect", "JSON"); _messagesFile = MyIni.Read("jsonFileName", "JSON"); _timerTickSec = Int32.Parse(MyIni.Read("timerTimeSeconds", "JSON")); setTimer(_timerTickSec); var threads = new List <Thread>(); _tcpClient = new JsonClientApp.tcpClient(); _tcpClient.init(configFilePath); Thread clientThread = new Thread(_tcpClient.start); clientThread.Start(); threads.Add(clientThread); foreach (var thread in threads) { thread.Join(); } return(true); }
public bool init(String configFilePath) { if (!File.Exists(configFilePath)) { return(false); } var MyIni = new Common.IniFile(configFilePath); _dbSchema = MyIni.Read("db_schema", "DATABASE"); _dbHostname = MyIni.Read("db_hostname", "DATABASE"); _dbSid = MyIni.Read("db_sid", "DATABASE"); _dbPort = Int32.Parse(MyIni.Read("db_port", "DATABASE")); _dbUser = MyIni.Read("db_user", "DATABASE"); _dbPassword = MyIni.Read("db_password", "DATABASE"); _dbReconnectInterval = Int32.Parse(MyIni.Read("db_reconnectInterval", "DATABASE")); //setTimer(_dbReconnectInterval); start(); return(true); }
public bool execute(string[] arguments) { //EBS_LOG_TRACE; if (arguments.Length > 1) { //EBS_LOG_CONSOLE("PricingManager " << PricingManager_VERSION); return(false); } // Command Line: ./PricingManager <CONFIG_FILE> (-c) if (arguments.Length != 1) { //EBS_LOG_CONSOLE("Usage: ./PricingManager <CONFIG_FILE> (-c)\n\t-c\tUse consule mode") return(false); } String configFilePath = arguments[0]; if (!File.Exists(configFilePath)) { return(false); } var MyIni = new Common.IniFile(configFilePath); _port = Int32.Parse(MyIni.Read("port", "JSON")); _heartBeatInterval = Int32.Parse(MyIni.Read("heartBeatInterval", "JSON")); bool ok = DBConnector.DBConnector.Instance.init(configFilePath); //_dbConnector = new DBConnector.DBConnector(); //_dbConnector.init(configFilePath); //var threads = new List<Thread>(); //ok = Common.TCPSocketServer.Instance.init(configFilePath, 100); ////_server = new Common.TCPSocketServer(); ////_server.init(configFilePath, 100); //_uiServer = new UIServer(); //_uiServer.init(configFilePath, 100); //Common.TCPSocketServer.Instance.OnMessageEvent += new Common.TCPSocketServer.onMessageHandler(_uiServer.onMessageReceived); //Common.TCPSocketServer.Instance.MessageReceived += new Common.TCPSocketServer.MessageReceivedHandler(_uiServer.onMessageReceived); //Thread dbConnectorThread = new Thread(DBConnector.DBConnector.Instance.start); //dbConnectorThread.Start(); //threads.Add(dbConnectorThread); //Thread serverThread = new Thread(Common.TCPSocketServer.Instance.start); //serverThread.Start(); //threads.Add(serverThread); //Thread uiServerThread = new Thread(_uiServer.start); //uiServerThread.Start(); //threads.Add(uiServerThread); //foreach (var thread in threads) // thread.Join(); return(true); }