Example #1
0
 public DataServer(ref StreamWriter log, ref LoadMonitor ldl, ref DB_Access dba)
 {
     this.i_Comm        = new Communication();
     this.logStream     = log;
     this.i_monDataLoad = ldl;
     this.dbAccess      = dba;
 }
Example #2
0
 public MainServer(string engineVersion, string master_server, string master_server_port, string connectionString, string DB_Machine, string language, string schema, int clientServerPort, int max_packet_size, ref ConnectionMonitor mon, ref LoadMonitor ldl, ref CPU_Monitor cpu, ref CtrlStation ctrl, Dispatcher transDisp, string db, string var_path, CustomRecept var_recept, ref Translator translator, string standby_server, string standby_server_web, string standby_server_port, string fail_fs, bool master_srv)
 {
     this.MasterMode       = master_srv;
     this.i_monConnections = mon;
     this.i_monDataLoad    = ldl;
     this.i_monCpu         = cpu;
     this.i_ctrl           = ctrl;
     this.var_translator   = translator;
     this.recept           = var_recept;
     if (!Directory.Exists(var_path + "\\LOG"))
     {
         Directory.CreateDirectory(var_path + "\\LOG");
     }
     this.m_var_path            = var_path;
     this.transactionDispatcher = transDisp;
     this.transactionDispatcher.language_default_index = language;
     this.m_engineVersion      = engineVersion;
     this.m_master_server      = master_server;
     this.m_master_server_port = master_server_port;
     this.m_connectionString   = connectionString;
     this.m_db_machine         = DB_Machine;
     this.m_schema             = schema;
     this.m_clientServerPort   = clientServerPort;
     this.m_max_packet_size    = max_packet_size;
     this.my_db     = db;
     this.m_fail_fs = fail_fs;
     if (this.m_fail_fs == "")
     {
         this.m_fail_fs = var_path + "\\failSafe.SQL";
     }
     else if ((int)this.m_fail_fs[this.m_fail_fs.Length - 1] != 92)
     {
         this.m_fail_fs += "\\failSafe.SQL";
     }
     else
     {
         this.m_fail_fs += "failSafe.SQL";
     }
     this.failSafeFile       = !File.Exists(this.m_fail_fs) ? new FileStream(this.m_fail_fs, FileMode.Create, FileAccess.Write) : new FileStream(this.m_fail_fs, FileMode.Truncate, FileAccess.Write);
     this.failSafe           = new StreamWriter((Stream)this.failSafeFile);
     this.failSafe.AutoFlush = true;
     if (this.MasterMode && standby_server.Length > 0)
     {
         this.i_ctrl.standby_server      = standby_server;
         this.i_ctrl.standby_server_web  = standby_server_web;
         this.i_ctrl.standby_server_port = Convert.ToInt32(standby_server_port);
         try
         {
             this.tcpClientStandBy = new TcpClient(standby_server, Convert.ToInt32(standby_server_port));
             this.netStreamStandBy = this.tcpClientStandBy.GetStream();
             if (this.WriteMsgToClient(ref this.netStreamStandBy, "STANDBYSQL_ALIVE"))
             {
                 if (this.ReceiveMsgFromClient(ref this.netStreamStandBy, this.m_max_packet_size) != "STANDBYSQL_ACCEPTED")
                 {
                     this.tcpClientStandBy.Close();
                     this.netStreamStandBy.Close();
                 }
                 else
                 {
                     ctrl.StandByAlive = true;
                 }
             }
         }
         catch (ArgumentNullException ex)
         {
             ex.ToString();
         }
         catch (ArgumentOutOfRangeException ex)
         {
             ex.ToString();
         }
         catch (SocketException ex)
         {
             ex.ToString();
         }
         catch (Exception ex)
         {
             ex.ToString();
         }
     }
     this.lockArea   = new LockArea();
     this.lstClients = new ArrayList();
     if (this.MasterMode)
     {
         this.createScheduler();
     }
     this.StartServer();
 }