Telnet Server in C# : How do I turn off local echo so their password is hidden?

I have written a telnet server in c#, using tcp/ip. I send strings back n forth.

I want to disable local echo for when the user is prompted to enter their password. I have combed the net, and found that sending a telnet escape character xFF followed by other characters can do this. I've tried it, and it simply echo's these characters onto the screen rather than interpreting them.

If you have any idea how to do this, please post me a bit of code that tells me how. I've set up all the connection and everything:

                  NetworkStream ns = myClient.GetStream();
                  StreamWriter sw = new StreamWriter(ns);
                  StreamReader sr = new StreamReader(ns);

I send strings with sw.Write followed by a flush().

All help appreciated! I have tried various things already, but failed. Good luck!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I believe the escape is <escape>&k0L
PandilexAuthor Commented:
Ah well. Can't win them all. This has to be the least documented thing I have ever seen, which is very surprising considering the popularity.
see above pandilex .. this will work with 99% of clients.
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

PandilexAuthor Commented:
I tried it when you first posted but it didn't seem to work. What I really need is a bit of code that has been tested and really works.

I think the points justify knocking together a quick bit of code! :)
That code HAS been tested I use it here with windoews telnet without issue .. can you post your code in question? I might be able to tell you whats wrong with it.
PandilexAuthor Commented:
I can't because I was using it to test the server I was writing, and to save me from writing a client I wanted to just use telnet... and in the time since I posted the question I am well into the client development.

But what I did was create all the streams etc. then just do a  streamwriter.write and put what you said first in. The windows telnet app simply echo'd that to the screen rather than interpreting it as a command.
when I put that in .. <escape> is a special character .. did you use it as a special character?
PandilexAuthor Commented:
escape is \ in c#
hmm doing a quick lookup as it has been quite a while since I have done this it seems the proper way is to use the IAC escape command followed by DO etc Dunno why I had that particular sequence written down.

in bytes as 255, 251,1

see exchanges (sender sent, receiver responds graph)



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PandilexAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.