This is a simple chatroom application built using Python's socket
module. The application consists of a server and two types of clients—a console-based client and a GUI-based client—allowing users to communicate with each other over a TCP socket connection.
- Server-Side: Handles multiple client connections and broadcasts messages to all connected clients.
- Console Client: A command-line interface for connecting to the server and sending/receiving messages.
- GUI Client: A graphical interface for a more user-friendly chat experience.
To get started with the chatroom app, follow these steps:
-
Clone the repository:
git clone https://github.com/mainakm7/chatroom_app.git
-
Navigate to the project directory:
cd chatroom_app/TCP_socket
-
No additional dependencies are required for this application.
-
Open a terminal and navigate to the project directory.
-
Run the server script:
python server.py
Make sure to properly update the HOST IP and PORT. The server will start and listen for incoming connections on the specified port.
-
Enter the server's IP address and port in the client script.
-
Open a terminal.
-
Run the console client script:
python client.py
-
Start chatting! Messages typed in the terminal will be sent to all connected clients.
-
Enter the server's IP address and port in the client script.
-
Run the GUI client script:
python client_gui.py
-
Use the GUI to send and receive messages in a user-friendly interface.
- Server Port: The default port used by the server is
12345
. You can change this in theserver.py
file. - Server IP Address: By default, the server listens on
localhost
. You can update the IP address if you want to allow remote connections.
server.py
: The main server script that handles incoming client connections and broadcasts messages.client.py
: The console client script that connects to the server and allows users to send and receive messages via the command line.client_gui.py
: The GUI client script that connects to the server and provides a graphical interface for chatting.
-
The chatroom allows admins based on IP. Admins can use some special commands:
/kick nickname # to kick user based on username /listadmins # to list all admins /addadmin nickname # to add a user as an admin
/listusers # to list all users - Available to all users
-
All users can send public messages or private messages to specific users:
/private nickname msg
Feel free to submit issues or pull requests if you have suggestions or improvements. Please ensure any changes are well-documented and tested.
This project is licensed under the MIT License. See the LICENSE file for details.
- Python's
socket
module for providing the core functionality. tkinter
for the graphical user interface.- Inspiration from various network programming resources.