Exemple #1
0
        public void OnAccept(AChannel channel)
        {
            Session session = ObjectFactory.CreateEntity <Session>();

            session.Awake(this, channel);
            this.sessions.Add(session.InstanceId, session);
        }
Exemple #2
0
        /// <summary>
        /// 创建一个新Session
        /// </summary>
        public Session Create(IPEndPoint ipEndPoint)
        {
            AChannel channel = this.Service.ConnectChannel(ipEndPoint);
            Session  session = ObjectFactory.CreateEntity <Session>();

            session.Awake(this, channel);
            this.sessions.Add(session.InstanceId, session);
            return(session);
        }
Exemple #3
0
        public void Awake(NetworkComponent net, AChannel aChannel)
        {
            this.Network = net;
            this.Error   = 0;
            this.channel = aChannel;
            this.requestCallback.Clear();
            ulong id = this.InstanceId;

            channel.ErrorCallback += (c, e) =>
            {
                this.Error = e;
                this.Network.Remove(id);
            };
            channel.ReadCallback += this.OnRead;

            this.channel.Start();
        }
Exemple #4
0
 protected void OnAccept(AChannel channel)
 {
     this.acceptCallback.Invoke(channel);
 }