The Java Chat Client is a simple console-based client application that connects to a Java Chat Server. It allows users to send messages to the chat, change nicknames, and gracefully exit the chat. The client establishes a socket connection to the server and communicates through input and output streams.
The Java Chat Server is a multithreaded server application that facilitates communication between multiple clients in a chat room. Clients can connect to the server, choose nicknames, send messages, change nicknames, and gracefully exit the chat. The server uses Java's ServerSocket
for handling incoming connections and ExecutorService
for managing multiple threads to handle client connections concurrently.
- Connect to a Java Chat Server running on
127.0.0.1
and port9999
. - Send messages to the chat.
- Change nickname using the
/nick
command. - Gracefully exit the chat using the
/quit
command. - Multithreaded server architecture.
- Clients can join the chat, choose nicknames, and send messages.
- Nickname changing functionality using the
/nick
command. - Graceful exit with the
/quit
command. - Dynamic broadcast of messages to all connected clients.
- Robust error handling for client disconnections.
- Connect to Server: The client connects to the server running on
127.0.0.1
and port9999
. - Set Nickname: Upon connection, clients are prompted to enter a nickname.
- Send Messages: Enter messages in the console to send them to the chat.
- Change Nickname: Use the
/nick
command followed by the desired nickname to change it. - Exit Chat: Type
/quit
to gracefully exit the chat.
- The server runs on port
9999
by default. - The client establishes a socket connection to the server.
- Communication with the server is done using
BufferedReader
andPrintWriter
streams. - Input and output are handled in separate threads for asynchronous communication.
- Each client connection is handled by a separate thread using
ExecutorService
. - Communication between clients and the server is achieved through
BufferedReader
andPrintWriter
streams. - The server broadcasts messages to all connected clients.
- Compile the
App.java
file:
javac App.java
java App
Contributions are welcome! Feel free to submit issues or pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.