private static async void UserConnected(IChannel channel) { Channels.Networking.Windows.Tls. SecureChannel sChannel = null; try { sChannel = _global.CreateSecureChannel(channel); while (true) { var buffer = await sChannel.Input.ReadAsync(); Console.WriteLine(buffer.GetAsciiString()); sChannel.Input.Advance(buffer.End); } } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { sChannel?.Dispose(); channel?.Dispose(); } }
public SecureChannel CreateSecureChannel(IChannel channel) { var chan = new SecureChannel(channel, _channelFactory); if (_isServer) { chan.StartReading(new SecureServerContext(this)); } else { chan.StartReading(new SecureClientContext(this)); } return(chan); }