I am facing problem to create a session to a remote SFTP server by JSch:
The command i use to connect the sftp server through shell is:
I do not think there's an explicit support for selecting a network interface to connect from in JSch.
But you can implement a SocketFactory interface, such as that it creates a Socket
instance using the constructor overload with the localAddr:
public Socket(InetAddress address, int port, InetAddress localAddr, int localPort)
(use 0 for the localPort
)
Then pass the factory to the Session.setSocketFactory() before calling the connect()
and you should be good.