Hi Lothar ,

Thanks for your explanation. But this example program was written based on the ChannelSession.java and shell.java programs that are present in the jsch package, and this the way they use the read call and that is what is causing us the issue.
So which means the way in which the channelSession.java and shell.java program is written in jsch must also be changed.

Thanks
Aarthi




On Wed, Jun 18, 2014 at 7:28 PM, Lothar Kimmeringer <job@kimmeringer.de> wrote:
Am 18.06.2014 15:17, schrieb aarthit 2014:
>  InputStream io1 = System.in;
>  byte[] buf = new byte[32768];
>  int i = -1;
>
>  try {
> * _i=io1.read(buf, 0, 32768);_
> *
>  String str = new String(buf);
>  System.out.println ("I read " + buf + "as string" + str);
>  }
> catch (Exception e)
> {
>   System.out.println("Excecption received" + e );
> }
> }
> }
>
>
> In this program when we change the value of the third parameter
>  of the read call to value greater than 26608 we get the following
> exception when run in windows XP with java version 1.6.0_22
> *
> java.io.IOException: Not enough storage is available to process this command
> *
>
> But the same program is working fine when it is run in windows 7
> machine with same JRE version  even if we increase the values upto 32767.

The error-message comes from the operating system and has nothing to
do with Java/JSCH. See e.g.
http://answers.microsoft.com/en-us/windows/forum/windows_7-hardware/not-enough-storage-is-available-to-process-this/9624b57d-ea4c-41fa-aae0-b52e99b69fab
That's the first Google-Hit covering that error-message. As you
can see, the error can also occur on later versions of Windows
and I've seen this kind of error on other operating systems as
well (e.g. with a JVM on a BS2000-system - don't ask ;-)

The way you read in the data is not good practice anyway and can
lead to problems on Windows 7 as well, e.g. if not all data
resides in one TCP-packet and the seconds arrives delayed. A better
approach for that e.g. is

byte[] buf = new byte[maxLength]
int read;
int offset = 0;

while (offset < buf.length && (read = io1.read(buf, offset, Math.min(4096, buf.length - offset)) != -1){
  offset += read;
}


Cheers, Lothar

------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users