Client example needed for j2ssh

Christoph Schwaiger <[email protected]> Mon, 19 Jan 2009 11:12:20 +0100
Newsgroups gmane.comp.java.sshtools.user
Message-ID <OFA7C4BA98.CEAEDF90-ON00257543.00366E0B-C1257543.00380FC6@amadeus.com>
Hi,

last week I spent some time creating a ssh client class in java to be used 
for executing commands on many remote unix machines over a permanent 
connection.

The connection, authentication with pub key suppression of false host 
(intranet) keys works fine and as expected.

However I face problems with the I/O programming as soon as the 1st 
command is executed.

First I started with a shell and terminal, but I can't get a bullet proof 
issue-command / read output sequence with it. (pb: the read from the 1st 
command output is normally the login reply ("last login...") and the 
client is one output behind. I'm new to streams, took the examples, but 
don't  have a good feeling using them, i.e. having only blocking read(), 
available() always returning zero...)

So, I gave up the term&shell solution and direted to single commands and 
reopening the channel with executeCommand. technically again all fine, but 
the logic makes the solution even worse: before I can read the output of 
the command and get the exit code, the channel (upon request of the 
server) is closed and I don't get back a thing!

Has anyone of you a example which shows how to issue a command, get the 
output (stderr&stdout) securly as well as the exitcode of the command?
If it contains also a security mechanism to time out a command (send 
crtl-c ?) - would be great. 

Thanks in advance
Christoph



IMPORTANT  -  CONFIDENTIALITY  NOTICE  - This e-mail is intended only for 
the use of the individual or entity shown above as addressees. It may 
contain information which is privileged, confidential or otherwise 
protected from disclosure under applicable laws.  If the reader of this 
transmission is not the intended recipient, you are hereby notified that 
any dissemination, printing, distribution, copying, disclosure or the 
taking of any action in reliance on the contents of this information is 
strictly prohibited.  If you have received this transmission in error, 
please immediately notify us by reply e-mail or using the address below 
and delete the message and any attachments from your system. 

Amadeus Data Processing GmbH 
Geschäftsführer: Eberhard Haag 
Sitz der Gesellschaft: Erding 
HR München 48 199 
Berghamer Strasse 6 
85435 Erding 
Germany

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword

_______________________________________________
Sshtools-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sshtools-users