public virtual Session OnAccept(AChannel channel) { Session session = EntityFactory.CreateWithParent <Session, AChannel>(this, channel); this.Sessions.Add(session.Id, session); channel.Start(); return(session); }
/// <summary> /// 创建一个新Session /// </summary> public Session Create(string address) { AChannel channel = this.Service.ConnectChannel(address); Session session = EntityFactory.CreateWithParent <Session, AChannel>(this, channel); this.Sessions.Add(session.Id, session); channel.Start(); return(session); }
/// <summary> /// 创建一个新Session /// </summary> public Session Create(IPEndPoint ipEndPoint) { AChannel channel = this.Service.ConnectChannel(ipEndPoint); Session session = EntityFactory.CreateWithParent <Session, AChannel>(this, channel); this.Sessions.Add(session.Id, session); channel.Start(); return(session); }