Maybe flush the output stream before calling reset() ?
Oh yeah, one other thing, you might need to close the GZIP output first, I believe it does not finalize the gzip stream before close() is called. In which case you might have to close the whole stream stack you have going there and reopen it. Maybe consider handling the compression separately and only pushing the result to the output stream?
Some sample code:
Socket s = serverSocket.accept();
ByteArrayOutputStream compressed = new ByteArrayOutputStream();
GZIPOutputStream compressor = new GZIPOutputStream(compressed);
Msg m = new Msg("123", "123", karte);
m.writeObject (compressor);
compressor.close();
OutputStream fout = s.getOutputStream();
fout.write (compressed.toByteArray() );
fout.close ();
IF you can't close the stream, it gets slightly trickier. If the server does not close the stream, you do not get the EOS signal.This means you will have to accumulate incoming bytes in a buffer (ByteArrayOutputStream is handy), and manually scan the bytes as they come in for some end sequence, so that you know when to stop reading and start deserializing.
The above code comes with no warrantee of of course... :p