jsch


how to increase the jsch buffer size?


I am using jsch for sftp file transfer. When I send file using sftp command by setting the buffer size 512 (-B option ) sftp B 512 [sftp server name] and invoking put command, I can transfer files in 8.0MBPS. (The regular speed is 3.0MBPS).
When I do the same file transfer using jsch api in java, I get only 2.6MBPS. Is there any option to increase the buffer size in jsch or improve the speed of jsch?
Here is my code...
Channel channel = null;
ChannelSftp channelSftp = null;
log("preparing the host information for sftp.");
try {
JSch jsch = new JSch();
session = jsch.getSession(username, hostname, port);
session.setPassword(password);
java.util.Properties config = new java.util.Properties();
config.put("StrictHostKeyChecking", "no");
session.setConfig(config);
session.connect();
System.out.println("Host connected.");
channel = session.openChannel("sftp");
channel.connect();
log("sftp channel opened and connected.");
channelSftp = (ChannelSftp) channel;
channelSftp.cd(SFTPWORKINGDIR);
File f = new File(fileName);
channelSftp.put(new FileInputStream(f), f.getName());
log("File transferred successfully to host.");
} catch (Exception ex) {
System.out.println("Exception found while transfer the response.");
ex.printStackTrace();
} finally{
channelSftp.exit();
log("sftp Channel exited.");
channel.disconnect();
log("Channel disconnected.");
session.disconnect();
log("Host Session disconnected.");
}
Check out the newer version of Jsch (1.50), it became faster downloading.
It may work but I am not sure. I saw it somewhere in jsch code base.
You can try it out:
getSession().setConfig("max_input_buffer_size", "increased_size");

Related Links

JSCH setCommand is not working
com.jcraft.jsch.JSchException: SSH_MSG_DISCONNECT: 11 No appropriate prime between 1024 and 1024 is available. en
I'm trying to use Jsch to establish an SSH connection in Java.I got the Exception com.jcraft.jsch.jschexception unknownhostkey
com.jcraft.jsch.JSchException: failed to send sftp request
JSch for pbrun not working
JSCH read from input stream hangs from time to time
Hundreds of Apache SSHD clients leave hundreds of OpenSSH daemon processes running
Jsch - ssh connection through ssh tunnel
Changing password using Jsch and ChannelExec
how to delete local file using jsch after file is sent to remote SFTP server directory
com.jcraft.jsch.JSchException: Auth fail error
Creating a new file in SSH enabled system using JSCH
How to interact with the script after its execution using Jsch
java jsch -executing multiple unix commands
How to get one stream from error stream and input stream when calling a script using JSCH
SFTP using jschexception verify false sometimes fails

Categories

HOME
winforms
hook
netsuite
plot
jpeg
ckeditor
applepay
communication
google-cloud-spanner
moonmail
phaser
telephony
viewport
visual-composer
tar
angular2-aot
chromebook
pingfederate
filezilla
publish
replaceall
saas
jspm
media-queries
siesta-swift
calibre
vsts-build-task
phpfreechat
openoffice.org
catalog
nssegmentedcontrol
overriding
overlap
occlusion
streamsets
email-templates
sencha-touch-2.3
youcompleteme
jedis
rails-routing
clean-architecture
colorama
slickedit
tactic
android-cursor
windows-mobile-6.5
qtwebview
sqlbulkcopy
sts-springsourcetoolsuite
py2app
flash-cs5
hill-climbing
testng-dataprovider
hexdump
php-internals
two-factor-authentication
freedesktop.org
natvis
iad
intel-fortran
icu4j
mutation-observers
simple-framework
tmuxinator
quicklisp
sframe
tableau-online
splash
createprocessasuser
sortedlist
python-green
modalpopup
rake-task
clicktag
flask-cors
google-reader
phpthumb
kgdb
rtmfp
monomac
cos
libstdc++
mt
gnu-prolog
pydot
blackberry-playbook
digest-authentication
gamequery
compiler-specific
boost-smart-ptr

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App