Example #1
0
        public void ServerSocket_OnClientConnect(object sender, AsyncUserToken e)
        {
            string      sRemoteAddress;
            TModuleInfo ModuleInfo = new TModuleInfo();

            sRemoteAddress = e.EndPoint.Address.ToString();
            DBShare.MainOutMessage("M2连接: " + e.EndPoint.ToString());
            if ((!DBShare.CheckServerIP(sRemoteAddress)))
            {
                DBShare.MainOutMessage("非法服务器连接: " + sRemoteAddress);
                e.Socket.Close();
                return;
            }
            if (!(THumDB.boDataDBReady && THumDB.boHumDBReady && DBShare.g_boStartService))
            {
                e.Socket.Close();
            }
            else
            {
                ModuleInfo.Module     = e;
                ModuleInfo.ModuleName = "游戏中心";
                ModuleInfo.Address    = string.Format("{0}:{1} → {2}:{3}", sRemoteAddress, e.EndPoint.Port, sRemoteAddress, 6000);// Format("%s:%d → %s:%d", new object[] {sRemoteAddress, Socket.RemotePort, sRemoteAddress, ServerSocket.Port});
                ModuleInfo.Buffer     = "0/0";
                ModuleInfo            = DBShare.AddModule(ModuleInfo);
            }
            TServerClient ClentSocket = new TServerClient(e, FrmIDSoc);

            e.Tag = new object[] { ClentSocket, ModuleInfo };
        }
Example #2
0
        private void IDSocket_OnConnected(object sender, NetFramework.DSCClientConnectedEventArgs e)
        {
            m_dwCheckServerTimeMin = HUtil32.GetTickCount();
            m_dwCheckServerTimeMax = 0;
            m_dwCheckRecviceTick   = HUtil32.GetTickCount();
            string sRemoteAddress = e.socket.RemoteEndPoint.ToString();// e.EndPoint.ToString();

            //开启心跳包
            KeepAliveTimer.Change(0, 3000);
            TModuleInfo ModuleInfo = new TModuleInfo();

            ModuleInfo.Module     = this;
            ModuleInfo.ModuleName = DBShare.g_sServerName;
            ModuleInfo.Address    = string.Format("%{0}:%{1} → %{2}:%{3}", sRemoteAddress, e.socket.LocalEndPoint.AddressFamily.ToString(), sRemoteAddress, e.socket.RemoteEndPoint.AddressFamily.ToString());
            ModuleInfo.Buffer     = "0/0";
            m_Module = DBShare.AddModule(ModuleInfo);
        }