aspose file tools*
The moose likes I/O and Streams and the fly likes StreamCorruptionException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "StreamCorruptionException" Watch "StreamCorruptionException" New topic
Author

StreamCorruptionException

Hunter McMillen
Ranch Hand

Joined: Mar 13, 2009
Posts: 492

Hey everyone,

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.

Layout:
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.

Problem:
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!

Thanks,
Hunter


"If the facts don't fit the theory, get new facts" --Albert Einstein
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18907
    
    8

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.)
Hunter McMillen
Ranch Hand

Joined: Mar 13, 2009
Posts: 492

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.

Hunter
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: StreamCorruptionException