9swampy / Telnet

Published on Nuget at https://www.nuget.org/packages/Telnet

Home Page:http://www.nugetmusthaves.com/Package/Telnet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to filter out remote echo of my commands

arkypita opened this issue · 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", "")?

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?