   [java] Networking Oddity (output to telnet user)
  I'm sure there's a easy solution to this oddity, but I've got a program that displays on the server program (written in java, of course) what the user has typed (char by char), but when I try to use a bufferedwriter or a printwriter, i get double chars in telnet.Say I typed "test" into my program, my java program sees "test" normally, but when it trys to output the stuff as it's typed to the telnet user (so you can see what you're doing) you get what looks like:" teesstt"Instead of "test" the way it should be.I'm guessing there's a simple solution here, but I have no idea.   
  Well first I would check each individaul server read and see what is actually coming across.  If double letters are coming across, I'd check where you are packaging up the characters to be transmitted.   ;  It's REALLY streightforward. I make a socket, and wrap the input and output with buffered readers/writers, and then immediately thereafter run this:private void HandleInputOutput ()    {   char temp;   try   {   // Set up the input/output system  istrm = sckt.getInputStream ();  ostrm = sckt.getOutputStream ();  bfdr = new BufferedReader (new InputStreamReader (istrm));  prtw = new PrintWriter (new OutputStreamWriter (ostrm));  // while temp is read a value, and that value != -1  while ((temp = (char) bfdr.read ()) != (char) - 1)  {   //print char for server, write out char to user (problematic, see other comment)... System.out.print (temp); //prtw.print(temp); //prtw.flush();// getting double chars.  }  System.out.println("\nConnection broken");   }   catch (Exception e)   {  System.out.println ("Exception of type " + e.getClass () + "With message \"" + e.getMessage () + "\" occoured in HandleInputOutput method.");   }    };  If I'm understanding you correctly, you have a server that is handling input from a telnet application (basically you write whatever you want, i.e: NOT the telnet protocol). You take the input, print it to STDOUT at the server program and then echo it back to the client telnet app using a PrintWriter, right ?Well, if your telnet client has local echo set to ON it will display everything you type. So, when you type 't', it displays 't', then another 't' from the server arrives and is also displayed, resulting in double 't'.If you delay the sending through the network to, say, at each line termination (when the user presses Enter), you'll see it happening with whole lines.You can easily change your code to do that, you just have to read a line from the BufferedReader (using, what else - readLine) and echo it back to telnet.   ;  That still doesn't help, I don't have local echo, i'm running the telnet built into cmd as the DOS version, and it has no local echo.   ;  Sorry to double post, but I've also posted this on the sun java forums, and havent gotten a helpful response there either. I've manually set local echo off in telnet  before trying this, using both letter by letter, and line by line versions of my program, using flush, and omitting it (for no echo at all), and have not solved the problem.   ;  Telnet does locally echo commands. You can test this quite easily by telnetting to port 25 of any SMTP server and typing. You will see what you type. SMTP servers do not echo your commands, they simply respond.   ;  yes, the text mode telnet utility on windows definitely echos input. The GUI telnet util had an option to turn echo on or off. I believe the graphical version was only available on Win9x, and the textmode version on WinNT.   