P2PTransfer is a Java-based peer-to-peer (P2P) desktop application that enables users to:
- Discover peers on the same network
- Connect securely using session codes
- Transfer files directly between devices
- Chat in real-time (mini WhatsApp-style system)
The application is built using Java (Swing GUI) and follows a decentralized architecture — meaning no central server is required.
- Automatically finds devices in the same local network
- Uses a discovery service to detect available peers
- Connect using a unique session code
- Ensures controlled and secure communication
- Send and receive files seamlessly
- Supports large file handling
- Queue system for multiple file transfers
- Built-in messaging system
- Chat bubbles UI (WhatsApp-style)
- Bi-directional communication
- Built using Java Swing
- Clean and interactive UI
- Drag & drop file support
-
Once connected, both peers can:
- Send files
- Receive files
- Chat simultaneously
- Connect / Disconnect functionality
- Handles peer connection lifecycle
P2PTransfer/
│── src/
│ ├── Main.java
│ ├── AppFrame.java # Main GUI
│ ├── PeerServer.java # Server for incoming connections
│ ├── PeerClient.java # Client for outgoing connections
│ ├── PeerConnection.java # Core communication logic
│ ├── DiscoveryService.java # Peer discovery system
│ ├── DiscoveredPeer.java # Peer model
│ ├── Protocol.java # Communication protocol
│ ├── SessionCode.java # Session management
│ ├── LocalNet.java # Network utilities
│ ├── SwingSync.java # Thread-safe UI updates
│
│── bin/ / out/ # Compiled files
│── .idea/ # IDE config
│── .gitignore
- Java JDK 8 or higher
- OS: Windows / Linux / macOS
- Same network connection (for peer discovery)
git clone https://github.com/your-username/P2PTransfer.git
cd P2PTransferjavac -d bin src/*.javajava -cp bin Main-
Launch the app on two devices
-
Devices discover each other automatically
-
Select a peer or enter session code
-
Establish connection
-
Start:
- Sending messages 💬
- Transferring files 📁
- Session-based connection prevents unauthorized access
- Direct peer-to-peer communication (no middle server)
- Structured protocol ensures safe data exchange
- ⏸ Resume interrupted transfers
- 🌐 Cross-network (internet-based) connection
- 📊 Transfer progress bar & speed tracking
- 📱 Mobile version (Android)
- Free to use, modify, distribute
- Only requires credit
Contributions are welcome!
Steps:
- Fork the repository
- Create a new branch
- Make changes
- Submit a Pull Request
Md. Al Imran Emon
This project demonstrates:
- Networking fundamentals
- Socket programming
- GUI design (Swing)
- Real-time communication systems
**Computer Networking Project. **Perfect for learning system design basics + networking + Java desktop development.
💡 If you like this project, consider giving it a star ⭐


