• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

Diff behaviour of getInputStream() of Process with Linux & NT

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi friends
I'm facing a strange problem,,, as im starting a process thru Runtime.exec(),which return me this Process object ,this process is a server which takes some time to start completely ,now im getting this process input stream thru process.getInputStream() after using Thread.sleep(x)so that my process can be started completely ,
This works nice on linux(means it gives me complete inputstream) but when i try to execute it on NT it gives me uncomplete inputstream and its vary time to time .
can anybody please help me out ..
Tx.
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hard to say - I think we need more info. What do you mean exactly by "incomplete input stream"? Is this an exception of some sort which is thrown? Perhaps you should show some of the code which you're using here, and describe exactly what it does which you consider a problem.
 
Jolly Ag
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry man to post my question in two groups .
Actually my mean to say "incomplete input stream"
is that suppose the Process gives 10 lines of mesg & suppose it takes 2 sec for it & when i try to read it than it give sometime 5 lines ,sometimes 6 lines and sometimes all lines ie it is very uncertain in case of NT (although im using sleep before reading them(mesg)),,,but in case of Linux it alwyas give me all lines of mesg.
thanx.
 
Jim Yingst
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you show the code you use to read the input stream? My guess is that you simply aren't reading all the input - you need a loop to guarantee that you keep reading until an end-of-file is reached. For example:

Here the "!= null" causes the program to keep looping and attempting to read lines until the end of output is reached. If you're not doing something like this, that's probably the problem.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic