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
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.
I solved the problem. ;-)
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.