camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mattias Severson <mat...@gmail.com>
Subject Re: Configuration of connection timeout when transmitting files to remote SFTP server?
Date Wed, 07 Jul 2010 11:13:21 GMT

Hmm, maybe I was to hastily to reply and file the issue yesterday. It turned
out that there is also a connection timeout on the JCH 
http://grepcode.com/file/repo1.maven.org/maven2/com.jcraft/jsch/0.1.42/com/jcraft/jsch/Channel.java#Channel.connect%28int%29
Channel  class, which is super class to the 
http://grepcode.com/file/repo1.maven.org/maven2/com.jcraft/jsch/0.1.42/com/jcraft/jsch/ChannelSftp.java?av=f
ChannelSftp  (via the 
http://grepcode.com/file/repo1.maven.org/maven2/com.jcraft/jsch/0.1.42/com/jcraft/jsch/ChannelSession.java?av=f
ChannelSession  class. 

That said, I have not been able to get any timeout what so ever using JSCH.
When I execute the the code below, I don't get passed the
"channel.connect(5000);" statement and it does not timeout...


File file = new File("toBeSent.txt");
JSch jsch = new JSch();

File knownHosts = new File("/home/.ssh/known_hosts");
jsch.setKnownHosts( knownHosts.getAbsolutePath() );
Session session = jsch.getSession("user", "ftp.company.com");
{
    session.setPassword("secret");
    session.setPort(2222);
}
session.connect(5000);

Channel channel = session.openChannel( "sftp" );
channel.connect(5000);
ChannelSftp sftpChannel = (ChannelSftp) channel;
sftpChannel.put(file.getAbsolutePath(), file.getName());
sftpChannel.exit();
session.disconnect();
-- 
View this message in context: http://camel.465427.n5.nabble.com/Configuration-of-connection-timeout-when-transmitting-files-to-remote-SFTP-server-tp696546p1044670.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message