Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_java thread: StreamCorruptedException


Message #1 by "Brad Urani" <bradurani@y...> on Tue, 21 Aug 2001 00:00:43
I'm using sockets to send serialized string and other objects using 
ObjectOutputStream.writeObject(). The first object I send from the server 
is received correctly, but all subsequest calls to writeObject() on the 
server cause a StreamCorruptedException on the receiving client. I read 
an earlier post on this site at 
http://p2p.wrox.com/archive/beginning_java/2000-09/23.asp that explains 
this bug and how its caused by multiple headers. It says there's a work 
around involving overwritting the writeHeader() method, does anyone know 
how to do this? I don't need to send more than one object at a time, but 
I can't make a new stream for every send because the stream has to be 
tied to the socket. I've tried flushing the stream before and after each 
send, but that doesn't work. Any help would be appreciated, thank you.

-Brad

  Return to Index