How mr-1504/p2p-file-sharing-system works
Project Type and Purpose
• This is a Java-based desktop P2P file-sharing application with a central tracker. It uses JavaFX for the GUI and implements a hybrid client-server / peer-to-peer architecture:
• The Tracker is a TCP/UDP server that maintains peer & file metadata.
• Each Peer runs both client (to talk to the Tracker & download chunks) and server (to serve file chunks) roles.
File‐Structure Analysis
• Top‐level:
• lib/ – bundled JavaFX jars
• resources/ – config.properties, CSS, i18n resource bundles
• src/main/java/ – MVC-style packages:
– controller/ (P2PController)
– view/ (P2PView)
– model/ (PeerModel, TrackerModel, FileInfor, ClientState, etc.)
– utils/ (ConfigLoader, EnvConf, GetLocalIP, RequestInfor, Log, etc.)
– main/ (Main.java entry point)
• No web frontend: pure desktop.
• Configuration via .env or resources/config.properties.
• Launcher Main.java can fork a Tracker thread or start peers only.
README Insights
• Two core components: Peer and Tracker.
• Communication:
• Peer–Tracker over TCP (requests, registrations) + UDP (keep-alive).
• Peer–Peer over TCP (chunk transfer).
• File broken into chunks for parallel multi-source download.
• GUI provides search, share, download, real-time logging.
Detail Requirements
• Every essential subcomponent (TrackerModel logic, Peer server socket, ConfigLoader).
• Data store in Tracker (in‐memory file index) and note that it does not store file contents.
• How a user action (e.g., “Search file”) propagates from UI down to network and back.
• The dual-role nature of each Peer,
• The centralized role of the Tracker,
• The MVC structure of the desktop app,
• The chunked, multi-source transfer mechanism,
• And the protocols (TCP/UDP) that tie it all together.