You could try something like the following:
ChannelExec channel = session.createExecChannel("the command to
execute");
channel.setOut(new NoCloseOutputStream(System.out));
channel.setErr(new NoCloseOutputStream(System.err));
channel.open().await();
// send any data if you need
if ((channel.waitFor(ChannelExec.CLOSED, timeoutInMillis) &
ChannelExec.CLOSED) == 0) {
// this is a timeout
}
2014-07-10 14:36 GMT+02:00 Penza Kenneth at MITA <[email protected]>:
> Hi,
>
> I am using MINA Java SSH client to execute a set of commands on a Linux
> server. The library I am using is built from source as I wanted to use the
> async interfaces (so that I can above the client blocking for IO). The
> client is working fine. However I want to implement a timeout within which
> the command must return. Is this functionality implemented in the MINA SSH
> library ?
>
>
> Thanks for your help
> Kenneth
>