Multi-client server in Java using sockets
A multithreaded TCP chat application built in Java. The server supports multiple clients connecting simultaneously, private messaging, user exclusion from messages, and banned phrases filtering β all configurable via a .txt file.
```bash java-server-with-clients/ βββ src/ β βββ Server/ β β βββ Server.java β βββ Client/ β β βββ Client.java βββ server_config.txt βββ README.md ```
- Multithreaded server: handles many clients in parallel
- Private messages:
/to <username> <message> - Exclusion-based broadcast:
/exclude <username> <message> - Banned phrases: messages containing banned words are blocked
- Configurable setup via
server_config.txt - Client list announcement on join
- Based on Java Sockets API for TCP communication
- Java SE 8+
- Java I/O & Networking (
java.io,java.net) - Threads & Synchronization
- Properties & File Configuration
Example:
port=1515 serverName=ChatZone bannedPhrases=spam,ads,curse
git clone https://github.com/Desstori15/java-server-with-clients.git
cd java-server-with-clients
2. Compile the server & client
javac src/Server/Server.java
javac src/Client/Client.java
3. Start the server
java src.Server.Server server_config.txt
4. Start one or more clients in new terminals
java src.Client.Client
π§ Example Commands (Client)
/to John Hello! β Send private message to user John
/exclude Mike Hello all (except Mike)! β Broadcast excluding one user
/banned β View the list of banned phrases
π Banned Phrase Filtering
If a user sends a message containing any banned phrase (defined in server_config.txt), the message is blocked and a warning is shown.
π‘ What I Learned
Java networking with ServerSocket and Socket
Real-time input/output using BufferedReader and PrintWriter
Managing concurrent clients with threads
Centralized server configuration through .txt files
Designing simple communication protocols
πββοΈ Author
Vladislav Dobriyan
@Desstori15