send arrow keys using ganymed ssh java
- by José Ramón Pérez Rubio
I am using Ganymed ssh to connect to a remote machine and apart from sending commands I need to send the arrows keys (left and right keys). I can send commands but when I send the arrows keys nothing happends.
This is what I have:
public boolean createShell() throws Exception
{
try
{
// ...
m_session= connection.openSession();
m_commandWriter = new OutputStreamWriter(m_session.getStdin());
String encoding=m_commandWriter.getEncoding();
//encoding is UFT8
m_errorPipe=new SSHSyncPipe(m_session.getStderr());
m_outputPipe=new SSHSyncPipe(m_session.getStdout());
m_outputPipe.start();
m_errorPipe.start();
// m_session.requestPTY("bash");
m_session.requestDumbPTY();
m_session.startShell();
m_shellCreated=true;
return true;
}
}
So if I use
m_commandWriter.write(ls"\r\n");
m_commandWriter.flush();
It works, but
m_commandWriter.write(37);//37 is the code for left arrow
m_commandWriter.flush();
Doesn't work.
Does anyone know what I am doing wrong?
Thank you