コード例 #1
0
ファイル: MFCC_Base.cs プロジェクト: ufjl0683/Center
        public virtual void init_RemoteInterface()
        {
            try
            {
                r_host_comm = (I_HC_Comm)RemoteBuilder.GetRemoteObj(typeof(I_HC_Comm), RemoteBuilder.getRemoteUri(RemoteBuilder.getHostIP(), (int)RemotingPortEnum.HOST, "Comm"));

            }
            catch(Exception ex) {
                ConsoleServer.WriteLine(ex.Message);}

            RemoteInterface.ServerFactory.SetChannelPort(remotePort);

            ServerFactory.RegisterRemoteObject(regRemoteType, regRemoteName);
            ConsoleServer.Start(consolePort);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: ufjl0683/Center
        static void Main(string[] args)
        {
            rhostobj = (I_HC_Comm)RemoteBuilder.GetRemoteObj(typeof(I_HC_Comm),
                RemoteBuilder.getRemoteUri(RemoteBuilder.getHostIP(), (int)RemotingPortEnum.HOST, "Comm"));

            if (!System.IO.Directory.Exists(timccexchg.Settings1.Default.OneMinVDCurrPath))
                System.IO.Directory.CreateDirectory(timccexchg.Settings1.Default.OneMinVDCurrPath);

            if (!System.IO.Directory.Exists(timccexchg.Settings1.Default.FiveMinVDCurrPath))
                System.IO.Directory.CreateDirectory(timccexchg.Settings1.Default.FiveMinVDCurrPath);

            if (!System.IO.Directory.Exists(timccexchg.Settings1.Default.OneMinVDHistPath))
                System.IO.Directory.CreateDirectory(timccexchg.Settings1.Default.OneMinVDHistPath);

            if (!System.IO.Directory.Exists(timccexchg.Settings1.Default.FiveMinVDHistPath))
                System.IO.Directory.CreateDirectory(timccexchg.Settings1.Default.FiveMinVDHistPath);

            if (!System.IO.Directory.Exists(timccexchg.Settings1.Default.EpConfCurrPath))
                System.IO.Directory.CreateDirectory(timccexchg.Settings1.Default.EpConfCurrPath);

            if (!System.IO.Directory.Exists(timccexchg.Settings1.Default.CommCurrPath))
                System.IO.Directory.CreateDirectory(timccexchg.Settings1.Default.CommCurrPath);

            init_tmr();
            setDateTimeFromHost();
            tmr1hour_Elapsed(null, null);

            while(true)
            System.Threading.Thread.Sleep(1000 * 60);
        }
コード例 #3
0
ファイル: MFCC_Base.cs プロジェクト: ufjl0683/sshmc
        void tmr1min_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            if (isInTmr)
              return;

              try
              {
              isInTmr = true;
              if (r_host_comm == null) return;
              ((RemoteClassBase)r_host_comm).HelloWorld();
              }
              catch
              {
              r_host_comm = null;
              new System.Threading.Thread(RemoteObjectConnectTask).Start();

              }
              finally
              {
              isInTmr = false;
              }
        }
コード例 #4
0
ファイル: MFCC_Base.cs プロジェクト: ufjl0683/sshmc
        void RemoteObjectConnectTask()
        {
            if (IsInRemoteObjectConnectTask)
              return;
              IsInRemoteObjectConnectTask = true;
              while (true)
              {
              try
              {
                  r_host_comm = (I_HC_Comm)RemoteBuilder.GetRemoteObj(typeof(I_HC_Comm), RemoteBuilder.getRemoteUri(RemoteBuilder.getHostIP(), (int)RemotingPortEnum.HOST, "Comm"));

                  if (r_host_comm != null)
                  {
                      ConsoleServer.WriteLine( "hostrobj connected");
                      break;
                  }
                  System.Threading.Thread.Sleep(5000);
                  ConsoleServer.WriteLine(mfccid + "host robj reconnecting!");
              }
              catch
              {
                  ;
              }

              }

             IsInRemoteObjectConnectTask=false;
        }
コード例 #5
0
ファイル: MFCC_Base.cs プロジェクト: ufjl0683/sshmc
        void Connect_Remote_Host_Comm_Task(object robj)
        {
            while (true)
            {
                try
                {

                    if (r_host_comm == null)
                    {
                        r_host_comm = (I_HC_Comm)RemoteBuilder.GetRemoteObj(typeof(I_HC_Comm), RemoteBuilder.getRemoteUri(RemoteBuilder.getHostIP(), (int)RemotingPortEnum.HOST, "Comm"));
                        if (r_host_comm != null)
                        {
                            ConsoleServer.WriteLine("r_host_comm" + " connected!");
                            return;
                        }
                        else
                            ConsoleServer.WriteLine("reconnect host remoteObject failed..reconnecting!");
                    }

                }
                catch
                {
                    ConsoleServer.WriteLine("reconnect host remoteObject failed..reconnecting!");

                }

                    System.Threading.Thread.Sleep(10000);

            }
        }
コード例 #6
0
ファイル: MFCC_Base.cs プロジェクト: ufjl0683/sshmc
        public virtual void init_RemoteInterface()
        {
            // mark 2012-7-26
            try
            {
                r_host_comm = (I_HC_Comm)RemoteBuilder.GetRemoteObj(typeof(I_HC_Comm), RemoteBuilder.getRemoteUri(RemoteBuilder.getHostIP(), (int)RemotingPortEnum.HOST, "Comm"));

                if (r_host_comm == null)
                    new System.Threading.Thread(RemoteObjectConnectTask).Start();
            }
            catch (Exception ex)
            {
                ConsoleServer.WriteLine(ex.Message + ex.StackTrace);
            }

                try
                {
                    RemoteInterface.ServerFactory.SetChannelPort(remotePort);
                    ServerFactory.RegisterRemoteObject(regRemoteType, regRemoteName);
                    ConsoleServer.WriteLine("RemotePort Listen at " + remotePort);
                }
                catch (Exception ex)
                {
                    ConsoleServer.WriteLine(ex.Message + ex.StackTrace);
                }
            ConsoleServer.Start(consolePort);
        }
コード例 #7
0
ファイル: MFCC_Base.cs プロジェクト: ufjl0683/Center
        void tmr1min_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            //throw new Exception("The method or operation is not implemented.");
              if (isInTmr)
              return;

              try
              {
              isInTmr = true;
              if (r_host_comm == null) return;
              ((RemoteClassBase)r_host_comm).HelloWorld();
              }
              catch
              {
              r_host_comm = null;
              new System.Threading.Thread(RemoteObjectConnectTask).Start();

              }
              finally
              {
              isInTmr = false;
              }
        }