//private HeartBeatMsg heartBeatMsg; public TcpConnection() { //GameWorld.Instance.OnApplicationQuit(Disconnect); new ServiceTask(new[] { typeof(IByteStorage), typeof(INetworkManager) }).Start().Continue(t => { _iNetworkManager = ServiceCenter.GetService <INetworkManager>(); _iSocketChannel = _iNetworkManager.Create("tcp") as ISocketChannel; _iSocketChannel.Setup(this); _iSocketChannel.OnChannelStateChange = OnServerStateChange; if (ServiceEventHandler != null) { ServiceEventHandler(); } // MsgHandler.Send((int)usercmd.MsgTypeCmd.Login, new usercmd.MsgLogin()); return(null); }); }