Skip to content

Latest commit

 

History

28 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Peer-to-Peer Chat System

A Python-based peer-to-peer (P2P) chat system with centralized registration and local GUI-based messaging. The system allows clients to register with a central server, connect to other clients directly, and maintain persistent message logs using SQLite.


Features

  • Peer-to-peer messaging with direct socket connections
  • Central server for client discovery and registration
  • Local SQLite database for message history
  • Tkinter-based GUI for sending and receiving messages
  • Modular code with separate handlers for client, database, and UI

Project Structure

p2p-main/
│
├── server/
│   └── server.py              # Handles client registration and user list management
│
├── client/
│   ├── client_chat_handler.py # Client-side P2P communication logic
│   ├── database_handler.py    # Handles SQLite database storage of chat history
│   └── gui.py                 # Tkinter GUI frontend

Requirements

  • Python 3.8+
  • No external libraries required (uses built-in socket, sqlite3, tkinter, threading)

How to Run

1. Start the Server

In a terminal:

cd server
uvicorn server:app --host 0.0.0.0 --port 8000

2. Launch Clients

Open two more terminals for separate clients:

cd client
python gui.py
(Db files would be autogenerated)

Testing

  • No unit tests yet. But, plan to implement:
  • Client registration and reconnection
  • Message sending and persistence
  • SQLite message retrieval

Future Improvements

  • Add encryption (e.g., RSA for key exchange, AES for message encryption)
  • Include chat history viewer in GUI
  • Add WebSocket support for better scalability
  • Group chat or file-sharing support

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages