Hi,
I am using the SFTP functionality of this system, and was wondering if
anyone has checked the classes for throughput, or for error handling
(dropped packets, delays, lost connection, etc). Also, I was wondering if
the class is checking server certificates, and if so what they're checking
against. I am still learning how SSH works, so please excuse any silly
questions.
Cut / Paste of relevant code (different stages are in different try/catch
blocks, which are removed here, as are the functions that create the
progress monitor):
JSch jsch=new JSch();
//
// Open the SSH session to the host. Host is the name, not IP.
//
Session session=jsch.getSession(ftpUserName, ftpHost, port);
//
// Password will be provided by the MyUserInfo class.
//
userInfo ui=new MyUserInfo(ftpUserName, ftpUserPass);
session.setUserInfo(ui);
//
// Connect the session, then the SFTP channel.
//
session.connect();
channel=session.openChannel("sftp");
channel.connect();
ChannelSftp cftp = (ChannelSftp)channel;
//
// Send the file.
//
cftp.put(currFileToSend, ftpTempFolder, pm, ChannelSftp.OVERWRITE);
public static class MyUserInfo implements UserInfo
{
private String password;
private String username;
public MyUserInfo( String username, String password ) {
this.username = username;
this.password = password;
}
public String getPassphrase() { return null; }
public String getPassword() { return password; }
public boolean promptPassword(String message) { return true; }
public boolean promptPassphrase(String message) { return true; }
public boolean promptYesNo(String message) { return true; }
public void showMessage(String message) { return; }
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users