Exemplo 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();
            }
        }
Exemplo 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();
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 为异步启动分布式系统提供支持
 /// </summary>
 protected void TrueStart()
 {
     if (Configuration.UseUDPToGetHosts)
     {
         lis.StartUdpReceive();
     }
     HostManager.Init();
     if (SelfAddress.Equals(RemoteAddress))
     {
         TestServer();
     }
     else
     {
         TestClient();
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// HostManager初始化
 /// </summary>
 public HostManager()
 {
     singleton = this;
 }
Exemplo n.º 5
0
 /// <summary>
 /// HostManager初始化
 /// </summary>
 public HostManager()
 {
     singleton = this;
 }