Esempio n. 1
0
        /// <summary>
        /// 尝试以管理主机身份开启分布式系统
        /// </summary>
        public void TestServer()
        {
            Socket testSocket = HostManager.TestConnectAll();

            if (testSocket != null)
            {
                new Peer(testSocket, MessageDealer.Message).send(new Msg(22));
            }
            else
            {
                ServerStart();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 开始选举
        /// </summary>
        public void Elect()
        {
            Socket testSocket = HostManager.BeginConnect(true);

            if (testSocket != null)
            {
                singleton.ClientStart(new Peer(testSocket, MessageDealer.Message));
            }
            else
            {
                singleton.ServerStart();
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 为异步启动分布式系统提供支持
 /// </summary>
 protected void TrueStart()
 {
     if (Configuration.UseUDPToGetHosts)
     {
         lis.StartUdpReceive();
     }
     HostManager.Init();
     if (SelfAddress.Equals(RemoteAddress))
     {
         TestServer();
     }
     else
     {
         TestClient();
     }
 }
Esempio n. 4
0
 /// <summary>
 /// HostManager初始化
 /// </summary>
 public HostManager()
 {
     singleton = this;
 }
Esempio n. 5
0
 /// <summary>
 /// HostManager初始化
 /// </summary>
 public HostManager()
 {
     singleton = this;
 }