De-serializing multiple objects

Martin martin.norbury at gmail.com
Sat Jun 25 13:15:22 EDT 2011


I have a client that sends a Java serialized object to a server. The server
then acknowledges this command and at a later date, when the command is
complete, sends a done message.

The server uses raw sockets and a single ObjectOutputStream for the
acknowledgement and the done, with a flush inbetween. 

I am not in a position to modify the server code.

I want to use Netty for the client code but am not sure on how to
de-serialize the reply objects. If I use an ObjectDecoder I can de-serialize
the first object (the acknowledgement) but the second object throws a
StreamCorruptionException. Having google'd around a bit the best I can come
up with is the server code should be closing or reseting the output streams
between sending the reply messages. Is there anything I can do client side
to overcome this - as I'm not able to change the server code.

I have tried using the CompatibleObjectDecoder and this works okay. However
this doesn't seem to be a valid choice as this class is marked deprecated
with warnings about random exceptions being thrown.

Any suggestions on how I could use Netty client side without modifying the
server code?

Many thanks, 
Martin

--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/De-serializing-multiple-objects-tp6515238p6515238.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list