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.1and port9999. - Send messages to the chat.
- Change nickname using the
/nickcommand. - Gracefully exit the chat using the
/quitcommand. - Multithreaded server architecture.
- Clients can join the chat, choose nicknames, and send messages.
- Nickname changing functionality using the
/nickcommand. - Graceful exit with the
/quitcommand. - 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.1and 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
/nickcommand followed by the desired nickname to change it. - Exit Chat: Type
/quitto gracefully exit the chat.
- The server runs on port
9999by default. - The client establishes a socket connection to the server.
- Communication with the server is done using
BufferedReaderandPrintWriterstreams. - 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
BufferedReaderandPrintWriterstreams. - The server broadcasts messages to all connected clients.
- Compile the
App.javafile:
javac App.java
java AppContributions are welcome! Feel free to submit issues or pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
