Пример #1
0
 private void StartService()
 {
     try
     {
         DBShare.MainOutMessage("正在启动服务器...");
         DBShare.LoadConfig();
         ServerSocket.Start(new IPEndPoint(IPAddress.Parse("0.0.0.0"), DBShare.g_nServerPort));
         SelectSocket.Start(new IPEndPoint(IPAddress.Parse("0.0.0.0"), DBShare.g_nGatePort));
         DBShare.g_boStartService = true;
         FrmIDSoc.Invoke((MethodInvoker) delegate() { FrmIDSoc.OpenConnect(); });
         this.Invoke((MethodInvoker) delegate() { MENU_CONTROL_START.Enabled = false; });
         this.Invoke((MethodInvoker) delegate() { MENU_CONTROL_STOP.Enabled = true; });
         DBShare.MainOutMessage("数据库服务器启动成功...");
         DBShare.SendGameCenterMsg(Common.SG_STARTOK, "数据库服务器启动完成...");
     }
     catch (Exception ex)
     {
         DBShare.MainOutMessage(ex.Message);
         DBShare.g_boStartService = false;
         this.Invoke((MethodInvoker) delegate() { MENU_CONTROL_START.Enabled = true; });
         this.Invoke((MethodInvoker) delegate() { MENU_CONTROL_STOP.Enabled = false; });
         FrmIDSoc.Invoke((MethodInvoker) delegate() { FrmIDSoc.CloseConnect(); });
         SelectSocket.Shutdown();
         ServerSocket.Shutdown();
     }
 }