Open SSH connection on specific network interface

2019-07-31 01:08发布

问题:

How can I configure JSch client to communicate using network interface other than default one?

回答1:

I do not think that it is possible. I have the same requirement and checked the source code provided along with JSch. The plain Socket is created without a local address or port.



回答2:

You can implement the SocketFactory interface to create a custom socket with a specified source interface, and then use session.setSocketFactory(...) to plug it into your JSch session.