private async void btnConnect_Click(object sender, EventArgs e) { if (Client != null) { await Client.DisconnectAsync(); } else { using (Client = new TelnetClient(23, RFCProtocol.Telnet)) { Client.NewConnection += Client_NewConnection; Client.RemoteDisconnected += Client_RemoteDisconnected; Client.IncomingMessage += Client_IncomingMessage; txtConsole.Text = null; SetConnected(false); await Client.ConnectAsync(txtHost.Text); } } }