Skip to content
Harsh Shah edited this page Nov 10, 2017 · 6 revisions

Welcome to the MobileP2P wiki! This wiki contains details about the design of MobileP2P.

Table of Contents
  1. Requirements
  2. Design
  3. Implementation
  4. Testing
  5. Evaluation

Requirements

  1. Upload a new file
  2. Show the list of files available on the network
  3. Download a file from the list of available files
  4. Elect a smart head to perform repilication
  5. Handle failures arising in the connectivity of one or more peers

Design

Discovery

Before performing any operations, the devices present in the network must be detected. Any new device connecting to the network will announce its presence to the network. All the connected devices will update their list of present devices and will respond back to the announcement.

Election

Election process will happen in the new device whenever it connects to the network. This new device will ask for resources present in all other devices and run the election. After election, it will announce the presence of new smart head to all the devices in the network.

Implementation

Communication

Communication between devices will be done using commands. All devices will recognize specific commands and respond accordingly.

Discovery

Devices are discovered in the local network using UDP broadcast. New device will announce its presence by broadcasting NEW command. All the connected devices will respond with PRESENT.

Device Resources

Device resources such as battery percentage, charging status, available memory are obtained for every device.

Election Algorithm

  1. Find devices with charging status
  2. If there are more than one devices with charging, select the one with highest battery level
  3. In case of more than one devices with highest battery level, select the one with highest total memory
  4. If new smart head is different than the old one, inform all devices in the network about the new smart head

Files list

List of all files present in a specific folder in the device is sent to other devices. Whenever a device will receive files list, it will update its own files list.

File transfer

Whenever a file download is requested, the requesting device will request different parts of file from different devices. Distribution of parts is done on the basis of resources present in a device. Java NIO FileChannel is used to write parts of a file simultaneously.

Testing

Evaluation