public void Start(int port) { _server = new IServerSocket(10, 1024 * 4); _server.Init(); _server.Start("0.0.0.0", port); _server.OnClientConnect += _server_OnClientConnect; _server.OnClientRead += _server_OnClientRead; _server.OnClientDisconnect += _server_OnClientDisconnect; }
public void StartMsgServer() { try { MsgServer = new IServerSocket(20, Int16.MaxValue); MsgServer.Init(); MsgServer.Start(M2Share.g_Config.sMsgSrvAddr, M2Share.g_Config.nMsgSrvPort); } catch { M2Share.MainOutMessage("{Òì³£} TFrmSrvMsg::StartMsgServer"); } }
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); }