71
votes

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#)

8
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

8 Answers

27
votes

the complete description of bittorrent protocol:

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

20
votes
10
votes
9
votes

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.

8
votes

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

4
votes

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

3
votes

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

Monotorrent

3
votes

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.