Esempio n. 1
0
        private void OnConnected(object sender, SocketAsyncEventArgs e)
        {
            var connected = new TCPConnection(e.AcceptSocket);

            connected.OnConnectionException += (ex) =>
            {
                if (ex is ReceiveMessageConnectionException)
                {
                    connected.Dispose();
                    _connections.Remove(connected);
                }
            };
            _connections.Add(connected);
            try
            {
                OnInboundConnection?.Invoke(connected);
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.ToString());
            }
            BeginAccept();
        }
Esempio n. 2
0
 public void Dispose()
 {
     _channel.Dispose();
 }