I have a Java application. I try to realize multiplayer chat with
Protocol, but I have a problem.
I can not display all the messages I receive at the client level (Server level works perfectly), because I give an entry to the user and create a thread to read messages from TCP client, then
. next line ();
You are blocking an exit from my application. I can create by Oscillation, but I still have not understood it completely.
I have two options:
- Send all new messages from the queue after sending the message per user.
- Somehow separate input and output.
I think you do not need to explain that in the first option, if the user leaves for a long time, you should send a message before you receive all these new messages.
Only the second option remains. I need take off entrance and exit and I found that in some "interactive tasks" There are two consoles, used for the first time to entry, others – for exit. But can I do it in a Java? And if I can, how?