简体   繁体   中英

Is there any ssh client supporting java.nio.channels.SocketChannel?

I developed a proxy application, by which users can telnet to it and send a "connect to xxx" command to connect to a ssh server. I use JSch as my ssh client:

JSch jsch = new JSch();
Session session = jsch.getSession(username, ip, 22);
Channel channel = session.openChannel("shell");
InputStream inp = channel.getInputStream();
OutputStream oup = channel.getOutputStream();
MyReader myReader = new MyReader(userOutputStream, inp);
new Thread(myReader).start();
MyWriterThread myWriter = new MyWriter(userInputStream, oup);
new Thread(myWriter).start();

then deal with input and output respectively in these two new threads. But the proxy's performance dropped rapidly with the increase of user amount for too many concurrent threads. So I want to use java.nio.channels.Selector and SocketChannel to decrease thread amount. However I can't find a ssh client supporting java.nio.*(eg: JSch, Apache sshd, sshtools, etc.). Does any other ssh client supporting java nio? Or are there some methods can connecting input/output stream with Selector and SocketChannel?

Thanks a lot!

As of 2015 there is an nio fork of JSCH:

https://github.com/lucastheisen/jsch-nio

I've used it and it does improve throughput significantly.

还有eBay的Parallec ,它使用Akka

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM