Skip to content

Desstori15/java-server-with-clients

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

java-server-with-clients

Multi-client server in Java using sockets

β˜• Java Multi-Client Chat Server

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.


Project Structure

 ```bash java-server-with-clients/ β”œβ”€β”€ src/ β”‚ β”œβ”€β”€ Server/ β”‚ β”‚ └── Server.java β”‚ β”œβ”€β”€ Client/ β”‚ β”‚ └── Client.java β”œβ”€β”€ server_config.txt β”œβ”€β”€ README.md ``` 

Features

  • 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

Technologies Used

  • Java SE 8+
  • Java I/O & Networking (java.io, java.net)
  • Threads & Synchronization
  • Properties & File Configuration

βš™ Configuration File: server_config.txt

Example:

port=1515 serverName=ChatZone bannedPhrases=spam,ads,curse


How to Run

1. Clone the repository

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

About

Multi-client server in Java using sockets

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages