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?
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.
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.