public override AClient GetClient(long id) { AClient client = null; this.idClients.TryGetValue(id, out client); return(client); }
public void Awake(AClient client) { this.client = client; this.requestCallback.Clear(); this.client.ErrorCallback += (c, e) => { this.error = e; this.Network.Remove(id); }; this.client.ReadCallback += this.OnRead; this.client.Start(); }
public virtual Session Create(IPEndPoint ipEndPoint) { try { AClient client = this.Server.ConnectClient(ipEndPoint); Session session = ObjectFactory.CreateWithParent <Session, AClient>(this, client); client.ErrorCallback += (c, e) => { this.Remove(session.id); }; this.sessions.Add(session.id, session); return(session); } catch (Exception) { return(null); } }
public override void Dispose() { if (this.listener == null) { return; } base.Dispose(); foreach (long id in this.idClients.Keys.ToArray()) { AClient client = this.idClients[id]; client.Dispose(); } this.listener?.Close(); this.innArgs.Dispose(); this.listener = null; }
protected void OnAccept(AClient client) { this.acceptCallback.Invoke(client); }
public void OnAccept(AClient client) { Session session = ObjectFactory.CreateWithParent <Session, AClient>(this, client); this.sessions.Add(session.id, session); }