This is another find in my workspaces!
Featuring this time a simple text based chat, based on a self-developed protocol allowing server client communication.
- Simple text chat
- Multithreaded Server
- Singlethreaded Client
- fully swing compatible
- Status messages in chat window (disconnects, errors etc.)
- Overview list with all connected clients
- Possibility to private/ group chat
The first thing to do is to start the server. This is as easy as it sounds just clicking on the "Start" button and we can leave the server alone, handling itself all connections etc.
Next step is to initiate a Client connection to the server. This can be done by starting the Client Chat application. Here we just need to specify the server's IP Address and an appropriate nick name.
Now we can see that the main window is enabled and we can now start chatting by typing some words into the textfiled below this chat window. On the right side the chatter list appears showing only one entry, us. Let's now invitate more people to show all features!
Next persons will be Alice and Bobby:
Here we can see that "Bobby" successfully connected to the server and received a message from "Chris". Furthermore a private message was sent to him only readable of him from "Alice".
After "Bobby" connected "Alice" also joined the chat and received the message from "Chris". Then "Alice" sent a private message to "Bobby". This could be done by unchecking "Chris" from the chat overview list on the right side.
This picture shows the final result when the user "chris" disconnected after chatting with Alice and Bobby.
If you want to know more how the connection is handled then you should take a closer look at the ServerClientHandlerThread and the ClientConnectThread. The main rule plays the MessageObject which is used to determine the connected Clients and their behavior.
Maven Project - with Source Code