I write a chat-server which sends a serialized objects to clients with a full message information (text, nickname, date etc.). And I try to make a client which should get this objects and unserialize it:
I want to run "other code" only after readObject get a new object via network. Is it possible?Code:
ObjectInputStream in = new ObjectInputStream(sock.getInputStream());
ChatMessage inMsg = (ChatMessage) in.readObject();
JMS is a very complex thing for this, because it can't work with a Socket object directly. RabbitMQ requires to run an own server, which is also not good for standalone application.