This project contains both a console-based C chat application and a GUI-based Python chat application that are interoperable with each other.
-
C Implementation:
client.c: Console-based chat clientserver.c: Chat server implementationcommon.h: Common definitions used by both client and server
-
Python Implementation:
chat_client.py: Tkinter GUI chat clientchat_server.py: Python implementation of the chat server
-
Data Files:
users.txt: Stores user account informationchatlog.txt: Stores chat historychat_logs/: Directory containing daily chat logs (Python client only)
- User registration and authentication
- Public chat messaging
- Private messaging between users
- Chat history viewing
- Encryption of messages (simple Caesar cipher for demonstration)
- File-based chat logs
- Cross-compatibility between C and Python clients
You can run either the C server or the Python server:
C Server:
server.exePython Server:
python chat_server.pyThe server will start listening on port 8888 by default.
You can use either the C console client or the Python GUI client:
C Client:
client.exe [server_ip]Python Client:
python chat_client.pyIn both clients, if you don't specify a server IP address, it will default to 127.0.0.1 (localhost).
The Python Tkinter client provides the following features:
-
User Authentication:
- Login with existing credentials
- Register new user accounts
-
Chat Interface:
- Scrollable message display
- Different colors for different message types
- Timestamps for all messages
-
Messaging Features:
- Send public messages to all users
- Send private messages to specific users
- View chat history
-
Notifications:
- Window title updates for new messages
-
File Logging:
- Automatic logging of chat messages to daily log files
- Logs stored in a
chat_logsdirectory
Both the C and Python implementations use the same message structure and protocol, ensuring compatibility between them. This means:
- A Python client can connect to a C server
- A C client can connect to a Python server
- Python and C clients can chat with each other through either server
- Windows socket library (ws2_32.lib)
- Python 3.6 or higher
- Standard library modules only (no external dependencies)
- The encryption used (Caesar cipher) is for demonstration purposes only and is not secure.
- Both server implementations store user credentials in plaintext, which is not secure for production environments.
- The Python client creates a separate log file for each day in the
chat_logsdirectory.
This project is provided as educational material and can be freely used and modified.