72

I am looking for a tutorial/blog post on how to implement bittorrent protocol step by step. How it works? How do you make requests to peers? and talk to trackers.

I do not mind the programming language (java,ruby,perl,c#)

Hamza Yerlikaya
  • 48,407
  • 41
  • 141
  • 236
  • 1
    I am interested in this and feel there has got to be some better knowledge out there so I put a bounty up. I'm looking for tutorials / walkthroughs of the protocol but any starting out pointers would be nice to see too. – Louis Sep 05 '11 at 12:10

8 Answers8

27

the complete description of bittorrent protocol:

http://jonas.nitro.dk/bittorrent/bittorrent-rfc.html

pesarak
  • 279
  • 3
  • 2
  • 4
    jonas.nitro.dk/bittorrent/bittorrent-rfc.html is a terrible source about the BitTorrent protocol. Parts of it is very convoluted and other parts is outright wrong. A better source is the inofficial specification here: https://wiki.theory.org/BitTorrentSpecification or the official here: http://bittorrent.org/beps/bep_0003.html – Encombe Oct 16 '16 at 19:34
21

There is the libtorrent library.

Here's the API documentation and examples.

Jonathan Prior
  • 5,754
  • 7
  • 28
  • 26
10

This is good source http://www.kristenwidman.com/blog/how-to-write-a-bittorrent-client-part-1/ She explains the process step by step...

Bhushan Lodha
  • 6,726
  • 7
  • 58
  • 99
9

I'd suggest you look at the spec and sources of some OSS clients. You'll have to do some work, but that's how programming works.

sanmai
  • 26,245
  • 12
  • 59
  • 74
Armandas
  • 1,690
  • 1
  • 17
  • 24
8

I'm currently implementing a BitTorrent client in Java using this specification.

macbirdie
  • 15,858
  • 6
  • 45
  • 52
4

Qt is very easy to read so you can read the Qt Torrent Example (C++)

Daniel
  • 879
  • 10
  • 18
Derick Schoonbee
  • 2,873
  • 1
  • 22
  • 38
3

Implementing the protocol is not that hard by following the specs. However, there are lots of internal things like storage, scalable server, peer/piece pick algorithm, etc.

Earlier BitTorrent implementation or BitTornado used python, which is easy to read. I personally found them useful to understand the internals.

goododd
  • 61
  • 3
3

This is a implementation of the bittorrent protocol done in .NET. Its source code is available on github and it has documentation

Monotorrent

blessanm86
  • 30,847
  • 14
  • 65
  • 77