Telnet
Telnet copied to clipboard
Error TaskCanceledException
I am gettiong this error after send one command: help
Unhandled exception. System.Threading.Tasks.TaskCanceledException: A task was canceled. at PrimS.Telnet.ByteStreamHandler.IsWaitForIncrementalResponse(DateTime rollingTimeout) at PrimS.Telnet.ByteStreamHandler.IsResponseAnticipated(Boolean isInitialResponseReceived, DateTime endInitialTimeout, DateTime rollingTimeout) at PrimS.Telnet.ByteStreamHandler.ReadAsync(TimeSpan timeout) at JoewAlabelTelnet.Program.RunCommand() at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state) at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
The difference is my telnet do not send any character like $ or > It just appears the blinking underline to write text.
The telnet runs only locally so not need login too. Here my full code:
private static string data;
private static Client client;
static async Task Main(string[] args)
{
using (client = new Client(args[0], int.Parse(args[1]), new CancellationToken()))
{
data = await client.ReadAsync();
Console.WriteLine(data);
RunCommand();
}
}
static async void RunCommand()
{
await client.WriteAsync(Console.ReadLine());
data = await client.ReadAsync();
Console.WriteLine(data);
RunCommand();
}
I can see the msg after I connect but I got error after try using any command. Can anyone help me, please? Thanks!