private void AcceptClientCallback(IAsyncResult res) { try { var c = new OTcpClient(Listener.EndAcceptTcpClient(res),this); c.Closed += this.OnClosed; Interlocked.Increment(ref ClientCount); this.log.InfoFormat("Client connected on {0}",c.EndPoint); this.log.InfoFormat("Client Count {0}", ClientCount); Listener.BeginAcceptTcpClient(this.AcceptClientCallback, Listener); } catch (Exception e) { this.log.Error("Client connection error",e); } }
private void AcceptClientCallback(IAsyncResult res) { try { var c = new OTcpClient(Listener.EndAcceptTcpClient(res), this); c.Closed += this.OnClosed; Interlocked.Increment(ref ClientCount); this.log.InfoFormat("Client connected on {0}", c.EndPoint); this.log.InfoFormat("Client Count {0}", ClientCount); Listener.BeginAcceptTcpClient(this.AcceptClientCallback, Listener); } catch (Exception e) { this.log.Error("Client connection error", e); } }
private void OnClosed(EventArgs eventArgs, OTcpClient oTcpClient) { Interlocked.Decrement(ref ClientCount); this.log.InfoFormat("Client Count {0}", ClientCount); }