public override async Task <bool> SendAsync(CommContext context) { if (_clientIpPort.CheckIpPort()) { var cmdStr = context.Command.Build(); await _server.SendAsync(_clientIpPort, cmdStr).ConfigureAwait(false); context.SendTime = DateTime.Now; _history.OnNext(context); return(await Task.FromResult(true).ConfigureAwait(false)); } return(await Task.FromResult(false).ConfigureAwait(false)); }
static void SendAsync() { string ipPort = InputString("Client IP:port:", _LastClientIpPort, true); if (!String.IsNullOrEmpty(ipPort)) { string data = InputString("Data:", "Hello!", true); if (!String.IsNullOrEmpty(data)) { _Server.SendAsync(ipPort, Encoding.UTF8.GetBytes(data)).Wait(); } } }