76

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
  • 49,047
  • 44
  • 147
  • 241
  • 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. – lsl Sep 05 '11 at 12:10

8 Answers8

28

the complete description of bittorrent protocol:

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

pesarak
  • 289
  • 3
  • 2
  • 7
    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
  • The link you provided is no longer accessible, which renders the whole answer useless now. Would you like to update it? perhaps adding some short details into the post itself? – Viacheslav Shalamov Jan 08 '23 at 17:04
24

There is the libtorrent library.

Here's the API documentation and examples.

Jonathan Prior
  • 6,114
  • 7
  • 29
  • 26
11

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,824
  • 7
  • 62
  • 100
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
  • 29,083
  • 12
  • 64
  • 76
Armandas
  • 2,276
  • 1
  • 22
  • 27
8

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

macbirdie
  • 16,086
  • 6
  • 47
  • 54
4

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
  • 71
  • 3
4

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

Daniel
  • 980
  • 9
  • 20
Derick Schoonbee
  • 2,971
  • 1
  • 23
  • 39
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
  • 31,439
  • 14
  • 68
  • 79