• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2133
  • Last Modified:

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!
0
Pandilex
Asked:
Pandilex
  • 5
  • 5
1 Solution
 
gregoryyoungCommented:
I believe the escape is <escape>&k0L
0
 
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.
0
 
gregoryyoungCommented:
see above pandilex .. this will work with 99% of clients.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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! :)
0
 
gregoryyoungCommented:
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.
0
 
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.
0
 
gregoryyoungCommented:
when I put that in .. <escape> is a special character .. did you use it as a special character?
0
 
PandilexAuthor Commented:
escape is \ in c#
0
 
gregoryyoungCommented:
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 http://support.microsoft.com/?kbid=231866. Dunno why I had that particular sequence written down.

in bytes as 255, 251,1

see exchanges (sender sent, receiver responds graph)

Cheers,

Greg
0
 
PandilexAuthor Commented:
Thanks!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now