Giter Site home page Giter Site logo

cnass1's Introduction

P2P File Transfer like Torrent

1. Introduction

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: System Design

1.1 Server side:

1.1.1. Requirement:

  • 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.

1.1.2. Implementation:

  • 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.

1.2 Client side:

1.2.1. Requirement:

  • 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.

1.2.2. Implementation:

  • 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.

2. Things have and haven't been implemented

2.1. Server side:

2.1.1 Things have been implemented:

  • 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.

2.1.2 Things haven't been implemented:

  • Sending message to ensure the client is online or not.
  • Know when the client is offline, remove and reset the information of the client.

2.2. Client side:

2.2.1 Things have been implemented:

  • 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.

2.2.2 Things haven't been implemented:

  • 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.

3. How to run the project

  1. Clone the project to your local machine.
  2. You'll need to run the Server first then run the Client(s).

3.1. Run the Server

  1. Open the project by your favorite IDE (IntelliJ IDEA, Eclipse, NetBeans, ...)
  2. Compile the server:
mvn compile
  1. Run the server:
mvn exec:java -Dexec.mainClass="Server.Server"
  1. The server will print the IP that it running on. Note that IP for login of the client.
  2. The server will ask for the amount of concurrent clients that you want to handle.
  3. The server now can work.

3.2. Run the Client

  1. Open the project by your favorite IDE (IntelliJ IDEA, Eclipse, NetBeans, ...)
  2. You can run the client directly by this command
mvn clean javafx:run
  1. Enter the IP that the server is running on.
  2. Fill in all the information and click login.
  3. The client now can work.

4. Demo

You can see the demo and report of the project here: Demo

cnass1's People

Contributors

nhoxtin15 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.