inputstream buffer instead of system.in

2010-07-26
2013-05-28
  • swathi kumar
    swathi kumar
    2010-07-26

    I was tring to code my own bytearrayinput stream buffer instead  of system.in as well as bytearrayoutput stream buffer instead of system.out in example source code using jsch package.But output buffer waits for inputstream and nothg gets displayed on terminal.similarly no 2 commands as inputstreambuffer works.is there a way I can work this out?

     
  • Jeevan
    Jeevan
    2010-08-06

    Hi,

    Sorry to bug you - as you have logged this discussion very recently I thought I can I ask you this:

    I'm very new to JSCH - downloaded the latest version and trying to connect to the ftp server. I tried with another Java FTP API(JSCAPE) and that worked fine. But my goal is to use JSCH as this has a lot of flexiblity in terms of licensing.

    Can you please give me the steps to connect to a ftp server. I'm using Windows machine and my ftp server is Linux.

    1) First of all, Do I have to install any SSH keys? if yes, what would you recommend?
    2) Is there any tutorial for JSCH?

    Here is my code - I'm getting "connect time out" error

    import com.jcraft.jsch.*;

    public class MySftp{
      public static void main(String arg){
            try{
                 JSch jsch=new JSch();
                 Session session=jsch.getSession("user", "myhost", 22);
                 session.setPassword("password");
                 session.connect(30000);
            }
            catch(exception e) {
                  System.out.println("error:" + e.printStackTrace());
            }
      }
    }

    I would really really appreciate if you can send me the code and steps to establish the connection.

    Thanks