What is BitTorrent?

BitTorrent is a protocol designed for transferring files. It is peer-to-peer in nature, as users connect to each other directly to send and receive portions of the file. However, there is a central server (called a tracker) which coordinates the action of all such peers. The tracker only manages connections, it does not have any knowledge of the contents of the files being distributed, and therefore a large number of users can be supported with relatively limited tracker bandwidth. The key philosophy of BitTorrent is that users should upload (transmit outbound) at the same time they are downloading (receiving inbound.) In this manner, network bandwidth is utilized as efficiently as possible. BitTorrent is designed to work better as the number of people interested in a certain file increases, in contrast to other file transfer protocols.
One analogy to describe this process might be to visualize a group of people sitting at a table. Each person at the table can both talk and listen to any other person at the table. These people are each trying to get a complete copy of a book. Person A announces that he has pages 1-10, 23, 42-50, and 75. Persons C, D, and E are each missing some of those pages that A has, and so they coordinate such that A gives them each copies of the pages he has that they are missing. Person B then announces that she has pages 11-22, 31-37, and 63-70. Persons A, D, and E tell B they would like some of her pages, so she gives them copies of the pages that she has. The process continues around the table until everyone has announced what they have (and hence what they are missing.) The people at the table coordinate to swap parts of this book until everyone has everything. There is also another person at the table, who we'll call 'S'. This person has a complete copy of the book, and so doesn't need anything sent to him. He responds with pages that no one else in the group has. At first, when everyone has just arrived, they all must talk to him to get their first set of pages. However, the people are smart enough to not all get the same pages from him. After a short while they all have most of the book amongst themselves, even if no one person has the whole thing. In this manner, this one person can share a book that he has with many other people, without having to give a full copy to everyone that's interested. He can instead give out different parts to different people, and they will be able to share it amongst themselves. This person who we've referred to as 'S' is called a seed in the terminology of BitTorrent. There's more about the various terms in a later section.
How does BitTorrent compare to other forms of file transfer?

The most common method by which files are transferred on the Internet is the client-server model. A central server sends the entire file to each client that requests it -- this is how both http and ftp work. The clients only speak to the server, and never to each other. The main advantages of this method are that it's simple to set up, and the files are usually always available since the servers tend to be dedicated to the task of serving, and are always on and connected to the Internet. However, this model has a significant problem with files that are large or very popular, or both. Namely, it takes a great deal of bandwidth and server resources to distribute such a file, since the server must transmit the entire file to each client. Perhaps you may have tried to download a demo of a new game just released, or CD images of a new Linux distribution, and found that all the servers report "too many users," or there is a long queue that you have to wait through. The concept of mirrors partially addresses this shortcoming by distributing the load across multiple servers. But it requires a lot of coordination and effort to set up an efficient network of mirrors, and it's usually only feasible for the busiest of sites.
Another method of transferring files has become popular recently: the peer-to-peer network, systems such as Kazaa, eDonkey, Gnutella, Direct Connect, etc. In most of these networks, ordinary Internet users trade files by directly connecting one-to-one. The advantage here is that files can be shared without having access to a proper server, and because of this there is little accountability for the contents of the files. Hence, these networks tend to be very popular for illicit files such as music, movies, pirated software, etc. Typically, a downloader receives a file from a single source, however the newest version of some clients allow downloading a single file from multiple sources for higher speeds. The problem discussed above of popular downloads is somewhat mitigated, because there's a greater chance that a popular file will be offered by a number of peers. The breadth of files available tends to be fairly good, though download speeds for obscure files tend to be low. Another common problem sometimes associated with these systems is the significant protocol overhead for passing search queries amongst the peers, and the number of peers that one can reach is often limited as a result. Partially downloaded files are usually not available to other peers, although some newer clients may offer this functionality. Availability is generally dependent on the goodwill of the users, to the extent that some of these networks have tried to enforce rules or restrictions regarding send/receive ratios.
Use of the Usenet binary newsgroups is yet another method of file distribution, one that is substantially different from the other methods. Files transferred over Usenet are often subject to miniscule windows of opportunity. Typical retention time of binary news servers are often as low as 24 hours, and having a posted file available for a week is considered a long time. However, the Usenet model is relatively efficient, in that the messages are passed around a large web of peers from one news server to another, and finally fanned out to the end user from there. Often the end user connects to a server provided by his or her ISP, resulting in further bandwidth savings. Usenet is also one of the more anonymous forms of file sharing, and it too is often used for illicit files of almost any nature. Due to the nature of NNTP, a file's popularity has little to do with its availability and hence downloads from Usenet tend to be quite fast regardless of content. The downsides of this method include a baroque set of rules and procedures, and requires a certain amount of effort and understanding from the user. Patience is often required to get a complete file due to the nature of splitting big files into a huge number of smaller posts. Finally, access to Usenet often must be purchased due to the extremely high volume of messages in the binary groups.
BitTorrent is closest to Usenet, in my opinion. It is best suited to newer files, of which a number of people have interest in. Obscure or older files tend to not be available. Perhaps as the software matures a more suitable means of keeping torrents seeded will emerge, but currently the client is quite resource-intensive, making it cumbersome to share a number of files. BitTorrent also deals well with files that are in high demand, especially compared to the other methods.
Where can I download the BitTorrent program?

There are several choices here, because unlike some peer to peer applications (such as Kazaa), the BitTorrent implementation is open source. This means that programmers are free to take the source code to the program and modify it, if they feel there is something they'd like to change. Here are the various clients of which I am aware:
Microsoft Windows

  • The Shad0w's experimental client - Recommended! This client incorporates the codebase of the official version as well as all the improvements of the experimental version, below. Additionally, there are some misc. bug fixes, improvements from the latest development CVS sources, a user preferences feature that remembers its settings, and more. I highly recommend this version! (alternate) (alternate 2)
  • burst! - Recommended! This client features a smaller memory footprint compared to the others, due to replacing the wxPython GUI with one written in Delphi. The GUI lets you control multiple transfers from a single window, in addition to many other handy features such as a built-in TorrentSpy-like capability. It uses the same Python back-end as The Shad0w's client so you also get all of the recent developments included therein.
  • burst plus! - A client which is based on the burst base and includes Spanish language support, as well as some other additions.
  • SimpleBT - Another fork of the burst code base that features Chinese language support.
  • ABC ("Another BitTorrent Client") - This is a relatively new client that includes many of the most recent changes in the experimental versions, as well as other added features such as controling multiple downloads from a single window, queueing, automatic seeding, etc. See also: Sourceforge page.
  • Official client - This is the "official" client in that it is the latest supported version from Bram Cohen, architect of BitTorrent. It has the fewest features of all the clients, and releases are much more conservative than the experimental versions. Use this if you want stability but don't need any of the common features of the other clients, such as upload rate limiting. See also: (CVS view), Sourceforge page.
  • Eike Frost's Experimental client - This is based on the official version, with patches to allow upload rate control and show statistics about the number of peers and seeds, among other things. New in the "-2" revision is support for displaying additional details about the peers that are connected, as well as some annoyance and bug fixes.
  • Azureus - A very nice Java client that incorporates a full-featured GUI with extensive visualizations/statistics about the transfer. You will need the 1.4 JRE installed to run this, which can be obtained from this link. See also: Screen shots.
  • Personal Torrent Collector (PTC) - This is an alternative GUI interface to the Python BitTorrent client. It has support for a number of interesting features, such as the ability to control the total bandwidth usage of a group of BitTorrent transfers, and RSS syndication for organizing torrent files. See also: SourceForge page.
  • Shareaza - Newer public beta versions of this program now include BitTorrent support, in addition to the eDonkey2k and Gnutella protocols. However, the BitTorrent support may still have bugs, and some things (such as seeding a file) may not be as straightforward as with dedicated BitTorrent clients.
  • NovaTorrent - I welcome reviews of this client. :-) I have not personally evaluated it yet.
  • BitTorrent++ - This is an alternative to the official client. It supports extra functionality such as multiple downloads from a single GUI. Some people (myself included) have experienced major bugs with this program, so consider it unstable and use a different client unless you want to experiment. It appears to be abandoned and has not had any bug fixes in a long time. Therefore, since these bugs have the ability to adversely affect the performance of the BitTorrent swarm, so pleae do not use this client.
Mac OS X

  • Official client v3.2.2a - This is the newest build of the client for OS X 10.2 (Jaguar.) It incorporates adjustments for upload rate control, as well as preferences for min/max port. Also included are some statistics (number of peers, total uploaded/downloaded) and support for Rendezvous (ability to find peers on the same side of the firewall and allow trackerless operation in the local domain.) Note: If you get the error message Download failed when you try to open a torrent with this version, try the following fix. Note: Apparently the new 3.2.2a version linked above fixes this glitch.)
    1. Move all installed copies/versions of bittorrent to the trash.
    2. Empty the trash.
    3. Open the BitTorrent_OSX_3.2.2a.dmg file again and copy the bittorrent program directly into the Applications folder.
  • Official client v3.1 - Try this previous version of the client if you have difficulties with 3.2.2.
  • 3.1 client with rate limiting patch - I have no additional details about this version.
  • Sarwat Khan's OS X client - You may also want to try this alternative to the stock OS X build. See also: Screenshots
  • Additionally, you should be able to run any of the various Python/wxPython based clients directly from the source code, but it may take a little bit of work. Here are the steps you should follow. Note, I am not a Mac user so I can't guarantee this will work, if someone could do it and send me the exact instructions, I'll post it here.
    1. Install Python. If you are running 10.2, download this bundle of Python 2.3a3 (see also: Home Page.) If you are running 10.1, there is a pre-packaged version here &emdash; please read the instructions on the home page, note that you cannot use stuffit with this archive. If you want more information on Python and Macs, try this link.
    2. Install wxPython. For 10.2 and Python 2.3, use this package (2.4.0.7). If you don't have Python 2.3, you may have to use a previous version, such as this one (2.4.0.2). This page at Sourceforge contains the latest as well as several previous versions.
    3. Install the source code for the BitTorrent client. The above section for Windows clients has links to source code.
    4. To start the GUI client, run "python btdownloadgui.py --responsefile file.torrent", where file.torrent is the torrent file which you have already downloaded. See also the section below on using the BitTorrent command line tools. Also, the command-line version of Python should be in your path for this to work. See this page for instructions on adding /usr/local/bin to your path.
Max OS 9

There is no official support for Mac OS 9. Further, wxPython does not seem to be ported to Mac OS 9, which means you cannot run the GUI versions. However, there is hope: you can still use BitTorrent, although it will take a little bit of extra work.
  1. Download and install MacPython. Please refer to this page for more information on Python and Macs.
  2. Download and unpack the source code to the client.
  3. Option-Drag the file btdownloadheadless.py from the source code to PythonInterpreter. Then click Set unix-like command line interpreter, and enter "--url http://server/file.torrent", except substitute the actual URL of the .torrent file. This is the same as the "download" link on whatever web page offered the torrent. Select Go and the file should begin downloading. If you get an error message that ends in ImportError: cannot import name getpid, use the following procedure:
    1. Find the file download.py from the source code (it's in the subfolder named BitTorrent) and open it with any plain-text editor.
    2. Search near line 23 for the following:

      from os import getpid, path, makedirs

      And remove the getpid word so that the line now reads:

      from os import path, makedirs
    3. Search near line 177 for the following:

      myid = (chr(0) * 12) + sha(repr(time()) + ' ' + str(getpid())).digest()[-8:]

      and change it to the following:

      myid = (chr(0) * 12) + sha(repr(time())).digest()[-8:]
    4. Save the file, and retry the above procedure for downloading, hopefully this time without the error message.
Linux/Unix

Most of the clients that are pure Python/wxPython (e.g. the official BitTorrent client, Eike Frost's experimental, Shad0w's experimental) will run under *BSD/Linux without problems. The source code tarballs for all of these clients are available at the home pages; see the links above. Clients written in other cross-platform languages such as Java (e.g. Azureus) should also work.
The biggest challenge to running a BT client under *BSD/Linux is getting the required libraries installed. At a minimum you will need Python 2.2 or greater. If you want to use the '-gui' versions of the clients you will also need wxWindows, which has Python bindings called wxPython. These should all be available as packages for your system. Your first step should be to consult your distribution's package system and get these prerequisites installed.
For Debian systems there is a package called bittorrent, which requires the python 2.2 package. You should also install the packages libwxgtk2.4-python and mime-support, if you plan to use the GUI version of the client.
If you are using Mandrake with Cooker, you might want to try the RPMs listed here.
Below are some general instructions for installing on a Unix/Linux system.
Install Python, preferably version 2.2. You can run "python -V" to see what version you currently have installed, if any. Also, you may have multiple versions of Python installed, so you might check /usr/bin for commands like python2.2 if plain python says it's version 1.x. If your distribution uses packages, use the search tool to find prepackaged versions before trying to manually install. Try here and here for Python RPMs.
Install wxPython if you want to use the GUI version. Note that this will require the GLib and GTK+ libraries, which are probably already on your system if you have GNOME installed. (Start here or search your distribution's package manager if you need GTK+.) You'll want to find the wxPython package corresponding to the version of Python which you have installed. For RPM systems such as RedHat and Mandrake, you might try the following wxPython RPMs corresponding to version 2.1, version 2.2, and version 2.3 of Python. More RPMs are available at the Sourceforge site, and you can also consult the wxPython download page. Please be aware that the RPMs linked above assume that Python is installed under /usr and that the Python libs are in /usr/lib/python2.x/. If this is not the case, you will probably need to tell the installer this information.
Finally, install the source tarball for the BT client to a directory of your choice. To integrate the client with your web browser, it will be necessary to associate files of type "application/x-bittorrent" with the BitTorrent client. You will need to add a line such as the following to your /etc/mailcap file:
application/x-bittorrent; /usr/local/bin/btdownloadgui.py --responsefile %s; test=test -n "$DISPLAY"
Note that you should substitute the correct path for the location in which you installed the source tarball. If don't have wxPython or would prefer to use one of the text-mode clients you can replace btdownloadgui.py with btdownloadcurses.py or btdownloadheadless.py. Also note there's an error in the INSTALL.unix.txt file, which is missing the --responsefile argument.
Other web browsers may have a different way of associating a command with a MIME-Type, so you may want to try looking at the preferences or init file for details.