I have a user defined class Message, whose object I would like to pass between the client and the server.
The Message class is as follows:
import jav
You need to create the ObjectOutputStream
before the ObjectInputStream
at both ends.
The reason is that, as described in the Javadoc, the respective constructors write and read a stream header. So the input stream constructor can't return until the output stream constructor at the peer has executed. So if you construct both input streams first there is a deadlock.