Code Monkey home page Code Monkey logo

bittorrent's Introduction

========== Lita's Bittorrent Client

This program is a command line tool that downloads a file from the Bittorrent network given a torrent file. It is able to connect to multiple peers, and use trackers using HTTP and UDP. It is written in Python.

This program was a learning exercise about networking and asynchronous I/O. Most of the program is written from scratch. I only use the bencode library to parse the torrent file, requests to send GET requests to the tracker (although I wrote a library to communicate with the tracker through UDP), and bitstring to have a robust bit array data structure.

###Things I've Learned from this Project:

  • The Bittorrent Protocol
  • Working with UDP packets
  • How to use Wireshark for debugging
  • Write asynchronous programs
  • Network programming in Python (sending packets, dealing with network errors, managing multiple IO connections)
  • HTTP Protocals with video streaming. The power of HTML5
  • Flask API
  • Concurrancy in Python! Use multiprocessing rather than threading unless you are doing IO!

###TODO List:

  • Handle uploading a file.
  • Optimize which piece to download by finding the rarest piece.
  • Reconnect to more peers when they drop.

I used Kristen Widman's blog as a guide. Her posts were extremely helpful. I couldn't have gotten this far without her guide.

Part 1: http://www.kristenwidman.com/blog/how-to-write-a-bittorrent-client-part-1

Part 2: http://www.kristenwidman.com/blog/how-to-write-a-bittorrent-client-part-2

I also used the Bittorrent Unofficial Spec to format my packets.

https://wiki.theory.org/BitTorrentSpecification

##Installation This project is currently in progress so I haven't packaged it yet properly. But you can install the necessary dependencies by using pip. Just run the following command:

pip install -r requirements.txt

##Running the program All you need to do is pass in a valid torrent file:

python run.py <your torrent file>.torrent

bittorrent's People

Contributors

lita avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bittorrent's Issues

question

I have following requrements:BT protocol can do?or changed can do?
(1)data is distributed fullly or incrementally which mode peer can choose?
(2)data distribution support priority?
thank you!

question

I have following requrements:BT protocol can do?or changed can do?
(1)data is distributed fullly or incrementally which mode peer can choose?
(2)data distribution support priority?
thank you!

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.