private TFrmIDSoc FrmIDSoc = null; //会话管理 /// <summary> /// 构造函数 /// </summary> /// <param name="e"></param> /// <param name="FrmIDSoc"></param> public TServerClient(AsyncUserToken e, TFrmIDSoc FrmIDSoc) { m_dwKeepAliveTick = GameFramework.HUtil32.GetTickCount(); m_sReceiveText = ""; m_sQueryID = ""; m_Module = null; m_dwCheckServerTimeMin = GameFramework.HUtil32.GetTickCount(); m_dwCheckServerTimeMax = 0; m_dwCheckRecviceTick = GameFramework.HUtil32.GetTickCount(); Socket = e; this.FrmIDSoc = FrmIDSoc; }
public void FormCreate(System.Object Sender, System.EventArgs _e1) { DBShare.Initialization(); DBShare.MainOutMessage("正在启动数据库服务器..."); FrmIDSoc = new TFrmIDSoc(this); FrmIDSoc.Show(); FrmIDSoc.Hide(); ModuleGrid.AllowUserToAddRows = false; ModuleGrid.RowHeadersVisible = false; ModuleGrid.ReadOnly = true; ModuleGrid.Columns.Add("MKMC", "模块名称"); ModuleGrid.Columns.Add("LJDZ", "连接地址"); ModuleGrid.Columns.Add("SJTX", "数据通讯"); ModuleGrid.Columns[0].Width = 80; ModuleGrid.Columns[1].Width = 468 - 80 * 2; ModuleGrid.Columns[2].Width = 80; ModuleGrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect; ModuleGrid.MultiSelect = false; ModuleGrid.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable; ModuleGrid.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable; ModuleGrid.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable; ModuleGrid.RowTemplate.Height = 18; ModuleGrid.Rows.Add(5); //M2套接字 ServerSocket = new IServerSocket(1000, Int16.MaxValue); ServerSocket.OnClientConnect += ServerSocket_OnClientConnect; ServerSocket.OnClientDisconnect += ServerSocket_OnClientDisconnect; ServerSocket.OnClientError += ServerSocket_OnClientError; ServerSocket.OnClientRead += ServerSocket_OnClientRead; ServerSocket.OnDataSendCompleted += ServerSocket_OnDataSendCompleted; //选择服务器套接字 SelectSocket = new IServerSocket(1000, Int16.MaxValue); SelectSocket.OnClientConnect += SelectSocket_OnClientConnect; SelectSocket.OnClientDisconnect += SelectSocket_OnClientDisconnect; SelectSocket.OnClientError += SelectSocket_OnClientError; SelectSocket.OnClientRead += SelectSocket_OnClientRead; SelectSocket.OnDataSendCompleted += SelectSocket_OnDataSendCompleted; ServerSocket.Init(); SelectSocket.Init(); CheckBoxShowMainLogMsg.Checked = DBShare.g_boShowLogMsg; //Units.Main.RankingThread = new TRankingThread(true); //Units.Main.RankingThread.Resume(); DBShare.SendGameCenterMsg(Common.SG_STARTNOW, "正在启动数据库服务器..."); TimerMain = new System.Threading.Timer(TimerMainTimer, null, 0, 1); TimerStart = new System.Threading.Timer(TimerStartTimer, null, -1, -1); TimerClose = new System.Threading.Timer(TimerCloseTimer, null, -1, -1); TimerStart.Change(0, 1000); }