I am working on a small chat program for a class I am taking and am running into a lot of stream issues which I hope someone can give me some ideas how to fix.
The basic setup of my program is the server-client model, I have a multi-threaded server which clients can connect to. When A client connects a ThreadHandler is spawned to hold the interaction between a single client and the server. Both the client and the ThreadHandler have an ObjectOutputStream and an ObjectInputStream object that are instantiated in their constructors.
I can call some operations without running into issues but when I call some I get this error
I believe that one of the streams is writing its header twice but I dont really know why. Any ideas on this would be great!
"If the facts don't fit the theory, get new facts" --Albert Einstein
But it's your program that's responsible for what the streams are doing. So your best bet would be to look at your code. (In fact that's always the best bet the first time you encounter a problem. It's almost always your fault, it's extremely rare that you're going to find a bug in the API.)
Sorry I wasn't trying to imply that there is a bug in the API, I know most assuredly this is my fault I just can't seem to find the problem. And was looking for suggestions on where to look, I'm unsure how the streams could be corrupted if they are only instantiated once and used for the whole interaction between the server and the client.