예제 #1
0
 public DB_Access(string connString, ref LockArea lockArea, ref CPU_Monitor cpu, ref CtrlStation ctrl, bool var_disableStandBy)
 {
     this.i_monCpu       = cpu;
     this.i_ctrl         = ctrl;
     this.disableStandBy = var_disableStandBy;
     this.MyConnection   = new OdbcConnection(connString);
     this.MyconnString   = connString;
     if (this.i_ctrl.StandByAlive)
     {
         if (!this.disableStandBy)
         {
             this.tcpClientStandBy = new TcpClient(this.i_ctrl.standby_server, this.i_ctrl.standby_server_port);
             this.netStreamStandBy = this.tcpClientStandBy.GetStream();
         }
     }
     try
     {
         this.MyConnection.Open();
         this.setDateFormat();
     }
     catch (OdbcException ex)
     {
         throw new Exception(ex.Message);
     }
     this.m_lockArea = lockArea;
 }
예제 #2
0
 public ServerThread(ref ServerNewConnInfo info, ref DataServer server, ref CPU_Timer cpuTimer, ref ConnectionMonitor con, ref StreamWriter stream, int max_packet_size, ref CtrlStation ctrl, ref CustomRecept recept, ref Translator translator, ref ArrayList lstClients)
 {
     this.i_ConnInfo        = info;
     this.i_DataServer      = server;
     this.i_monCpu          = cpuTimer;
     this.i_monConnections  = con;
     this.i_ctrl            = ctrl;
     this.m_max_packet_size = max_packet_size;
     this.logStream         = stream;
     this.var_recept        = recept;
     this.var_translator    = translator;
     this.var_lstClients    = lstClients;
     this.StandByTimer      = DateTime.Now;
 }
예제 #3
0
 public DB_Access(ref DB_Access ac)
 {
     this.i_monCpu         = ac.i_monCpu;
     this.MyconnString     = ac.MyconnString;
     this.i_ctrl           = ac.i_ctrl;
     this.failSafe_archive = ac.failSafe_archive;
     if (this.i_ctrl.StandByAlive)
     {
         this.tcpClientStandBy = new TcpClient(this.i_ctrl.standby_server, this.i_ctrl.standby_server_port);
         this.netStreamStandBy = this.tcpClientStandBy.GetStream();
     }
     this.MyConnection = new OdbcConnection(this.MyconnString);
     try
     {
         this.MyConnection.Open();
         this.setDateFormat();
     }
     catch (OdbcException ex)
     {
         throw new Exception(ex.Message);
     }
     this.m_lockArea = ac.m_lockArea;
 }
예제 #4
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();
 }
예제 #5
0
 public thread_Scheduler(ref CtrlStation ctrl)
 {
     this.i_ctrl = ctrl;
 }