• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

StreamCorruptionException

 
Ranch Hand
Posts: 492
Firefox Browser VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 492
Firefox Browser VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic