Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

What's the signal of completed sending and receiving the streams?  RSS feed

 
Pakawat Gibson LP
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm implementing the application which needs to detect the completion of streams in back and forth. I need suggestion on how to iterate checking them.

My program needs to wait for the received OutputStream to complete before write out and also needs to know that the InputStream is ready to be sent out there. The OutputStream is from the remote server and the InputStream is the command I want to send to it.

Many thanks
Max
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I am not clear about your question.
Are you saying that you are sending/recieving the stream objects thremselves to/from the server?
Stream objects are not supposed to be transfered over the wire.
 
Pakawat Gibson LP
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The thing is I use the open-source library to send the command to and receive the output from Unix server shell.

To implement the job I do something like:

toServer = shell.getOutputStream().write("command"); for sending

fromServer = shell.getInputStream(); for receiving

The problem is I will never know that when the server will be ready for the next command. If I send many commands in order, it will return me the mixed and meaningless bytes. I wonder if there's a way to investigate the stream like "this is the new one after the last one has flushed out".

I guess threading policy might help but what can I do as it's the process inside that library.

Any idea?

Many thanks again
[ July 24, 2008: Message edited by: Pakawat Gibson LP ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!