Telnet icon indicating copy to clipboard operation
Telnet copied to clipboard

How to filter out remote echo of my commands

Open arkypita opened this issue 2 years ago • 1 comments

Hi all, this is not an issue but an help request from you experts.

When I connect to my telnet server (linux telnetd from busybox 1.36) I have all my chars echoed back from te server, and from the tests I've done there doesn't seem to be a way to turn this behavior off.

This causes me that when I send a command, and I want to read the result of this command, i found the command itself in the return value of TerminatedReadAsync

await telnet.WriteLineAsync("pwd");
string serverResponse = await telnet.TerminatedReadAsync("$", TimeSpan.FromMilliseconds(2000));
Debug.WriteLine(serverResponse);

--- debug output ---
pwd
/home/arkypita
@box:~$

Is there a way to filter out the echo, other than trivially removing the command from the response serverResponse.replace("pwd", "")?

arkypita avatar Jul 17 '23 09:07 arkypita

I've just been bumping the dependencies and adding in a Net8 target but gave this a go too while publishing 0.12. I've extended the Client ctor to additionally accept options to send during negotiation. Depending on your setup if you send Dont Echo or Do SuppressLocalEcho it may sort your issue.

Let me know if it helps?

9swampy avatar Apr 17 '24 22:04 9swampy