File put problem -- Pleeeeeease help

Help
hvc1998
2007-01-26
2013-05-28
  • hvc1998
    hvc1998
    2007-01-26

    Hi, I am a newbie on using jsch. I am trying to build a java standalone program that sends data to an sftp server. I tried using the Sftp.java on the examples link on the website. I was successfully able to connect to the sftp server and i can send data to it. The problem is i cannot send large files. Whenever i run my program, it completey hangs. Is anyone here can help me with my problem. This is the sample code i am building. I did not anymore use the ProgressMonitor object like the one in the sftp example since this is a stand alone application. Is there anyone willing to help me... I have been stuck for 2 days already.

    JSch jsch=new JSch();
    session=jsch.getSession(user, host, 22);
    UserInfo ui=new MyUserInfo();
    session.setUserInfo(ui);
    session.connect();
    Channel channel=session.openChannel("sftp");
    channel.connect();
    ChannelSftp c=(ChannelSftp)channel;
    c.cd(path);
    int mode=ChannelSftp.OVERWRITE;
    c.put(filename,".",mode);
    c.exit();
    session.disconnect();

     
  • Jeevan
    Jeevan
    2010-08-06

    Hi,

    I'm having problem connecting to the ftp server.

    Can you please send me the steps and/or the code that i can refer to.

    I get "connect time out" error.

    Thanks