Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

basic question about streams

Status
Not open for further replies.

frag

Programmer
Dec 7, 2000
321
GB
Hi!

What is the right way to use streams?
Should I always open and close the stream for every object I want to send/receive or is it ok to let the stream open the whole time?

Cheers

frag

patrick.metz@epost.de
 
I usually go by what the interval between reads and/or writes to or from the stream is. If there is not very much time between ios then I leave it open. However, if a lot of time lapses, I close it and then reopen when I need it.

- Michael
 
What happens if I open two streams (one in each thread) and on the other side there is one stream for receiving... I get io-exceptions. And an "IndexOutOfBounce"-exception but this is a uncatched one, that means I don't know where this comes from...
Btw... I did not know that there can be 2 exceptions at the same time. I get the io-exception twice (for each thread) and the OutOfBounce appears only once.

Any ideas??

frag

patrick.metz@epost.de
 
>> What is the right way to use streams?

There is no cookbook approach. It depends on many aspects of your application.


-pete
 
Yeah... I got it! It was my stupid way of using threads and streams... no it works really fine. :)

patrick.metz@epost.de
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top