JSSH: no reply beyond initial greeting

  • David Raver

    David Raver - 2012-06-14

    I'm trying to write a simple ssh client. Not general purpose one, just so it would meet my needs.

    I started with jsch-0.1.48.zip/jsch-0.1.48/examples/Shell.java and replaced


    with (simplified)

    channel.setInputStream(new MyIn());
    channel.setOutputStream(new MyOut());

    MyIn is an extension of InputStream (overriding int available() and int read()), "hooked" onto a JTextArea, so everything I type into the GUI is getting fed through the read() method.

    MyOut is even simpler than MyIn: it extends OutputStream and overrides void write(int i), which appends i (or, rather "stringified" i) onto a JTextArea.

    OK so far. But!

    In spite of all the intended characters (including control chars like new line t.i. enter) getting read, that is, the MyIn's int read() method is getting called (by JSch channel, session, engine, whatever), nothing is coming back through MyOut. I mean, nothing but the intial greeting ("Welcome to Ubuntu, blah blah blah" ending with prompt) after a successful log in.

    What am I doing wrong? Or, what is System.in doing that I'm not? Should I override some other method? Should I "manually" append some other chars to the ones obtained from JTextArea "signalling" line terminators?

    I'm out of ideas so any help will be greatly appreciated.

  • David Raver

    David Raver - 2012-07-02

    I solved the problem. ;-)


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks