I have Java application. I try to realize multiplayer chat with TCP protocol, but I have an issue. I cannot output all messages I get on client tier (server tier works perfectly), because I give an input to user and create a thread to read messages from TCP client, so
Is blocking an output of my app. I can create by Swing, but I still haven’t fully understood it.
I have two options:
- Output all new messages from queue after sending message by user.
- Somehow detach input and output.
I think you don’t need to explain that in 1st option if user will go out for a long time, he will need to send a message before he will get all these new messages.
Only the second option remains. I need to detach input and output and I found that in some “interactive tasks” there are two consoles – first used for input, other – for output. But can I do it into a Java? And if I can, how?