Hi!

Your code runs in 0,7 seconds, so its not a problem of JSch but a 
problem with my code.

The main difference is that I do not set a ByteArrayOutputStream. I do a
InputStream is1 = jschChannel.getInputStream();
InputStream is2 = jschChannel.getExtInputStream();

and than poll at this streams in a loop. The reason for this is that I 
want to "mix" both stream because we have scripts that do output on both 
channels.

But again: Its my problem, not the one of JSch - so I have to fix it.

Thanks!

Am 09.08.2010 10:26, schrieb Atsuhiko Yamanaka:
> Hi,
>
>     +-From: Boris Klug<[email protected]>  --
>     |_Date: Fri, 06 Aug 2010 15:22:41 +0200 ____
>     |
>     |The only problem we have is a performance issue: When you execute
>     |a command on Unix using the ChannelExcec which generates a big
>     |output and you read these output, it takes a long time.  E.g. a
>     |"cat filename" for a 5 mb file takes about 17 seconds.  When you
>     |transfer the same file with sftp (ChannelSftp), the transfer takes
>     |under 1 second.
>
> I have tried them, but I have not found such a long delay
> with using ChannelExec.
> Is it possible to show me your code to get the result from "cat filename"?
> Here is a chunk of my code for "cat filename",
>
>    ...
>    Channel channel = null;
>    channel=session.openChannel("exec");
>    ((ChannelExec)channel).setCommand( "cat filename" );
>    ByteArrayOutputStream baos = new ByteArrayOutputStream();
>    channel.setOutputStream( baos );
>    long start = System.currentTimeMillis();
>    channel.connect();
>    while(true){
>      if(channel.isClosed()){
>        break;
>      }
>      try{Thread.sleep( 10 );}catch(Exception ee){}
>    }
>    System.out.println(System.currentTimeMillis() - start);
>    System.out.println(baos.size());
>    channel.disconnect();
>
> Sincerely,
> --
> Atsuhiko Yamanaka
> JCraft,Inc.
> 1-14-20 HONCHO AOBA-KU,
> SENDAI, MIYAGI 980-0014 Japan.
> Tel +81-22-723-2150
>      +1-415-578-3454
> Skype callto://jcraft/
> Twitter: @ymnk
>
>


Mit freundlichen Grüßen

Boris Klug

-- 
Boris Klug
Debeka-Hauptverwaltung
Abteilung BO/Q
Ferdinand-Sauerbruch-Str. 18
56058 Koblenz

Telefon: (0261) 498-3806
Telefax: (0261) 498-1541

E-Mail: [email protected]
Internet: www.debeka.de

Debeka Krankenversicherungsverein a. G., AmtsG Koblenz: HRB 125
Debeka Lebensversicherungsverein a. G., AmtsG Koblenz: HRB 141
Debeka Allgemeine Versicherung AG, AmtsG Koblenz: HRB 2300
Debeka Pensionskasse AG, AmtsG Koblenz: HRB 6683
Vorstand: Uwe Laue (Vorsitzender), Rolf Florian, Roland Weber,
Thomas Brahm, Dr. Peter Görg
Aufsichtsratsvorsitzender: Peter Greisler
Sitz Koblenz am Rhein

Debeka Bausparkasse Aktiengesellschaft, Amtsgericht Koblenz: HRB 1114
Vorstand: Jörg Phlippen, Dirk Botzem
Aufsichtsratsvorsitzender: Peter Greisler
Sitz Koblenz am Rhein

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to