示例#1
0
 /// <summary>
 /// HoldingServer初始化
 /// </summary>
 public HoldingServer()
 {
     singleton = this;
     self      = new ResHost(new IPEndPoint(Functions.SelfIP, Configuration.Port), Dns.GetHostName());
     self.rGroup(Configuration.Groups);
     self.searchService = Functions.SearchService;
     lis            = new Listener(Configuration.Port);
     lis.onAccept  += new AcceptHandler(lis_onAccept);
     lis.onReceive += MessageDealer.UDPReceive;
     server         = new ServerObject();
     client         = new ClientObject();
     remoteAddress  = Functions.RemoteIP;
     selfAddress    = Functions.SelfIP;
     state          = 0;
 }
示例#2
0
 /// <summary>
 /// HoldingServer初始化
 /// </summary>
 public HoldingServer()
 {
     singleton = this;
     self = new ResHost(new IPEndPoint(Functions.SelfIP, Configuration.Port), Dns.GetHostName());
     self.rGroup(Configuration.Groups);
     self.searchService = Functions.SearchService;
     lis = new Listener(Configuration.Port);
     lis.onAccept += new AcceptHandler(lis_onAccept);
     lis.onReceive += MessageDealer.UDPReceive;
     server = new ServerObject();
     client = new ClientObject();
     remoteAddress = Functions.RemoteIP;
     selfAddress = Functions.SelfIP;
     state = 0;
 }
示例#3
0
 /// <summary>
 /// 处理主机断开
 /// </summary>
 /// <param name="peer">断开的主机</param>
 public static void onPeerQuit(Peer peer)
 {
     if (HoldingServer.State == 1)
     {
         if (peer.info.id == null)
         {
             return;
         }
         ResHost rh = HostManager.Singleton[peer.info.id.ToString()];
         if (rh != null)
         {
             rh.rGroup(new string[0]);
         }
     }
     else if (peer == HoldingServer.Client.server)
     {
         HoldingServer.Start(false);
     }
 }