Hi
Its my first post

Im doing a java Netbeans program to connect into SSH server, this SSH server is used to connecto to others machines using telnet or SSH.
Im using Jframe and 2 TexArea one input and one output
The program woriking fine I can send a recive data from/to server. the server is Unix and I can send unix command.

To send data to server:
try {
//fout.write(sMensaje.getBytes());
//fout.write(KeyEvent.VK_ENTER);
//fout.flush();
DataOutputStream dataOut = new DataOutputStream(ch.getOutputStream());
dataOut.writeUTF(sMensaje);
dataOut.write(KeyEvent.VK_ENTER);
dataOut.flush();
// ventana.mensajeRecibido(sMensaje);
} catch (IOException e) {
JOptionPane.showMessageDialog(ventana, "No se pudo enviar el mensaje");
}

To recive data:
InputStream stream = ch.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));

String line = reader.readLine();
// while(!line.endsWith(endLineStr)) {
while (line != null) {
// System.out.println(line);
ventana.mensajeRecibido(line);
line = reader.readLine();

Problem:
es > telnet 10.194.2.2
This will create a new /home/emigbur/.telnetrc
Press RETURN to continue, CTRL-C to abort
Execute "xauth add $XAU" in target environment
If the path isn't set up you maybe need to write eg. /usr/X/bin/xauth
This may also be executed by a login script...

If $XAU isn't transfered to the target environment
you'll need to manually add the cookie by typing or pasting
this: xauth add 10.196.0.200:21 MIT-MAGIC-COOKIE-1 10e6c597b2b3874de80a42ddc9f842b9


Trying 10.192.2.1...
Connected to 10.192.2.1.
Escape character is '^]'.

erivalid

login: ^@

erivalid

Connection closed by foreign host.
Is like the server and client are not sync.
I tried to add xForwarding whitout success
Cans some one know how to fix it.

Out off topic.
Im my out text area I had the outscroll but I have to sroll manually how I can set it to auto scroll and see the lasted message

thanks in advance