This repository contains a simple multithreaded web server implementation in Java. The server is designed to handle multiple client connections concurrently, allowing clients to send and receive messages in real-time. This is a basic implementation that can be extended with additional features such as user authentication, persistent message history, and a graphical user interface.
The project consists of the following components:
Server
: Listens for incoming connections and spawns a new thread for each client.Client
: Connects to the server and handles sending and receiving messages.Worker
: Manages the client's input and output streams, broadcasting messages to all connected clients.
Ensure you have Java installed on your machine. Compile the source files and run the server:
javac Server.java Client.java
java Server
The server will start and listen for client connections on the default port (8089).
To connect clients, open separate terminal windows and run:
java Client
Each client will be prompted to enter messages which will then be broadcast to all connected clients.
- Multi-threaded server handling multiple client connections.
- Client-to-client communication via server broadcasting.
- Command-line interface for client interactions.
- Graceful handling of client disconnections.
Contributions are welcome. Here's how you can contribute:
- Fork the repository.
- Create a new branch for your feature (
git checkout -b feature/fooBar
). - Commit your changes (
git commit -am 'Add some fooBar'
). - Push to the branch (
git push origin feature/fooBar
). - Create a new Pull Request.
If you want to contact me you can reach me at [email protected].
This project is licensed under the MIT License - see the LICENSE file for details.