2011-08-05

Using a custom local IP for SFTP with JSch

I had to send a file using sftp to a remote host. Because there is more than one IP on my local host I had to look for a possibility setting the address. You can set the SocketFactory of the session you use. So writing your own SocketFactory allows you to use a custom IP.

Class MySocketFactory.java


In your class where sending the file, you can set the factory as follow:

1 Kommentar: