This project is a simple implementation of a P2P file transfer system like torrent. The implementation is by Java and JavaFx. You can see the system design here:
- The server is responsible for storing the list of files that are available for sharing and from which client that file is available. (Note that the server doesn't really store the files)
- The server is also responsible for keeping track of the clients that are connected to the server.
- The server must allow concurrent connections from multiple clients.
- The server must be able to handle multiple clients at the same time.
- The server must be able to handle multiple requests from the same client at the same time.
- The server must be able to handle multiple requests from different clients at the same time.
- The server must be able to handle multiple requests from different clients for the same file at the same time.
- The server is implemented as a multi-threaded server.
- The server opens thread and listen for connection from the clients.
- The server store necessary information of clients (IP, port, files).
- The server sends to clients the list of files that are available for sharing.
- The server open a listener for each client to listen for the request from the client.
- Then the server process the request and handle the request.
- The server doesn't a UI, it can just be a console application.
- The client must be able to connect to the server.
- The client must be able to send a request to the server to get the list of files that are available for sharing.
- The client must be able to send a request to the server to download a file.
- The client must be able to download a file from another client.
- The client must be able to share a file with other clients.
- The client must be able to download a file from multiple clients at the same time.
- Sending files and receiving files can be done concurrently.
- The client is implemented also a multi-threaded client. (tho the client doesn't open threads all the time)
- When the client starts, it connects to the server by the input IP got from the login form.
- The client sends a request to the server to get the list of files that are available for sharing.
- When the user want to download a file, the client sends a request to the server and open a connection listener for the connection of clients that have the file.
- When the clients receive request for a file, it open a thread that handled the sending of the file.
- Multi-thread of the server. The server can handle multiple clients at the same time.
- The server can obtain the list of files from the clients.
- The server can handle request for list of files from the clients.
- The server can handle requests for downloading a file for clients.
- The server can handled when exception occurs.
- Sending message to ensure the client is online or not.
- Know when the client is offline, remove and reset the information of the client.
- The client can connect to the server.
- Multi-thread of the client. The client can handle multiple requests at the same time.
- The client can send a request to the server to get the list of files that are available for sharing.
- The client can send a request to the server to download a file.
- The client can download a file from another client.
- The client can share a file with other clients.
- Checksum of the file to ensure the file is not corrupted.
- Handshake protocol to ensure the receiving client is online and is the right clients.
- BandWidth control for file transfering.
- Clone the project to your local machine.
- You'll need to run the Server first then run the Client(s).
- Open the project by your favorite IDE (IntelliJ IDEA, Eclipse, NetBeans, ...)
- Compile the server:
mvn compile
- Run the server:
mvn exec:java -Dexec.mainClass="Server.Server"
- The server will print the IP that it running on. Note that IP for login of the client.
- The server will ask for the amount of concurrent clients that you want to handle.
- The server now can work.
- Open the project by your favorite IDE (IntelliJ IDEA, Eclipse, NetBeans, ...)
- You can run the client directly by this command
mvn clean javafx:run
- Enter the IP that the server is running on.
- Fill in all the information and click login.
- The client now can work.
You can see the demo and report of the project here: Demo