private async void ConnectionReceived(object sender, ListenerConnectEventArgs e)
        {
            var value = await GetSubscription(e.RemoteAddress, e.RemoteClient.ReadStream);

            if (value != null)
            {
                value.ReceivedMessage(e.RemoteClient);
            }
            else
            {
                var buffer = Encoding.UTF8.GetBytes(NetworkState.AccessDenied.ToString());
                await e.RemoteClient.WriteStream.WriteAsync(buffer, 0, buffer.Length);

                await e.RemoteClient.WriteStream.FlushAsync();

                await e.RemoteClient.DisconnectAsync();

                e.RemoteClient.Dispose();
            }
        }
Ejemplo n.º 2
0
        private void OnConnectionReceived(object sender, ListenerConnectEventArgs e)
        {
			if (ConnectionReceived != null) {
				ConnectionReceived.Invoke(sender, e);
			}
        }