BitTorrent is a peer-to-peer (P2P) file and bandwidth sharing network. While most people are familiar with the idea of P2P file sharing -- making files on your own PC available to others on the Internet -- the concept of bandwidth sharing is a relatively new one. BitTorrent enables small Web and file servers to host very large or very popular files for download without bringing down their machines under the load of multiple incoming connections, and without completely consuming expensive bandwidth.
When you download a BitTorrent file (called a "torrent"), you may not get it all from the server that you got the hyperlink from. Instead, you will begin to download pieces of that file from a variety of BitTorrent servers that have that file and are near you. By running BitTorrent, you also turn your machine into a BitTorrent server. This means that you will automatically upload pieces of the file that you have downloaded while continuing to retrieve the rest of the file from the other servers. So everyone eventually gets the file while drastically reducing the load on the main server, supplementing its bandwidth with the others that share the file. BitTorrent clients are democratic, giving download preference to the servers that have the most bandwidth and the most pieces of the file. Overall, the desired effect is for all users to get the file more quickly and reliably than they would otherwise have been able to.
BitTorrent comprises both a piece of client/server software and a protocol. There are several popular BitTorrent clients that supplement the existing BitTorrent software by adding enhanced GUIs, download managers, and other features.
The original BitTorrent client and protocol is written in Python and can run from the command line on any platform that has Python 2.2 or greater installed. To run BitTorrent 4.0 in graphical mode, you'll need at least Python 2.3 with wxPython, plus GTK 2.2 or greater and pygtk 2.4 or greater.
BitTorrent's code is licensed under the BitTorrent Open source License. If your current Linux distribution does not include BitTorrent in its package manager or base system, you can download an RPM or a source tarball from the BitTorrent site. Binaries are also available for Windows and Mac OS X.
Although there are several BitTorrent clients, for this article we're going to concentrate on Azureus, a graphical, GPL-licensed, Java-based BitTorrent client. The only requirement that Azureus 2.0.22 has is the Java Runtime Environment version 1.5.0_02 or higher. If that's not in your distro's package manager, you can download Azureus as a zipped tarball from SourceForge.
BitTorrent has attracted the attention of copyright lawyers who view it as the next great tool for piracy. BitTorrent itself is not illegal to use -- it is merely a tool, and one with legitimate users and uses in the "real world."
There are, however, numerous people using BitTorrent to distribute files in violation of copyright law. Since, as soon as you start to download a file with BitTorrent, you also start to share it (if you want to be able to download effectively), this does have potential legal ramifications. By adopting BitTorrent, copyright infringers have been able to decentralize their file networks, leaving the copyright holders (and their lawyers) with no choice but to chase after individual end-users of the software or, in a current case in Australia, their ISPs.
When you first open BitTorrent, don't be tempted by illegal downloads; by initiating an illegal download you will also be sharing it with others.
Installing BitTorrent and Azureus
Before you install BitTorrent, check that you have the required versions of Python, pygtk, GTK, and wxPython installed on your system, as detailed above. You may need to move up to a newer version of the distribution than you are currently using, or you may have to upgrade individual packages using your distribution's package management utility.
If you can't install from a package manager, installing BitTorrent from the source tarball is simple -- just untar the package into the directory you want it in, then set up a mimetype for it as detailed in the instructions.
Like BitTorrent, installing Azureus from source requires a simple unzip (using bunzip) of the downloaded file and extraction of the files using tar. Azureus can be run from a script file (./azureus) from its install directory on your machine, assuming you have the Java Runtime Environment installed.
The first time you run Azureus, the installation wizard will prompt you to run some basic tests, most importantly to check that your firewall will allow the BitTorrent service to open up a port on your machine to connect to the Internet.
The BitTorrent protocol gives preference to users who are sharing more files and more bandwidth. If your firewall is preventing users from connecting to your BitTorrent software (which typically runs on ports 6881 - 6889) then your downloads will be very slow indeed.
If you are behind a corporate firewall or otherwise unable to change your configuration, then you may find that using any BitTorrent client is a very ineffective way of downloading files that you could download by other means.
Azureus provides a pleasant GUI to guide you through both the process of downloading via the BitTorrent protocol and creating your own torrent files to share from your machine. As the BitTorrent protocol runs on the client machines rather than the server, any HTTP server should be capable of serving torrent files.
To download a torrent, you'll first have to find one. You will come across BitTorrent files being offered on a large number of Web sites, but if you want to search for a specific torrent, you can find it through specialized search engines, such as TorrentSpy.com.
|Click to enlarge|
Installing Azureus will not automatically associate it with torrent files. When you click your first torrent file for download, your browser should prompt you for what to do with the file. Choose the option to open, and select Azureus as the application to open the file with. Azureus will automatically display a dialog asking you where you would like to save the file -- and then you're done.
Once your download is running, the Azureus GUI will keep you informed of how much bandwidth is being used up- and downstream, how much of the file you have downloaded, and the ETA for the completed file. It will also comment on the health of the download, which takes into account how many download peers you have been able to find, and how many of them have connected to you -- in effect, a measure of your "popularity" in the democratic BitTorrent network.
Azureus adds additional functionality over the standard BitTorrent client, including the ability to resume failed or partial downloads, and maintaining a queue of pending downloads. In this respect, Azureus acts as a download manager, as opposed to a simple BitTorrent client.
If you are concerned about bandwidth usage or the number of connections to your machine, you can use Azureus to configure the behavior of the BitTorrent protocol (at least as implemented with Azureus) to a fine degree through the built-in control panel.
If you want to monitor your downloads in detail, Azureus provides an in-depth "piece level" view of your download in which you can see what pieces of the file are downloading or have already downloaded, the clients that they came from, and the relative performance of each of these. You will also see the pieces of the file that you are giving away here as well -- an excellent way of double-checking that your firewall alterations have been successful.
Using Azureus to create torrents
If you want to use BitTorrent to distribute your own files, you will need to create a torrent file. Azureus offers a simple step-by-step wizard that walks you through the process of creating the torrent itself and a tracker -- a log of which users are downloading the file and where the file and its fragments reside -- for your server. Once you have your torrent file and your tracker, you're ready to upload them to your Web site.
Azureus supports the creation of trackers for single files or directories, providing ample flexibility for beginners and advanced users alike. There are power options for more advanced users, but the defaults produce a torrent file without any noticeable problems.
Overall, Azureus eases the transition from traditional downloading to BitTorrent downloading gracefully, keeping the user interface simple while providing sufficient options for BitTorrent power users. By mimicking the functionality and look and feel of a traditional download manager, it provides an excellent introduction into what is otherwise a potentially complex and confusing environment.
The success of BitTorrent itself can be measured in the high level of adoption that it has found throughout the open source community. Its key benefit in this environment is not that it speeds downloads (in some cases it does not), but that it provides a mechanism for lightweight servers to host large or popular downloads and for the networked community to make the best use of its available hardware resources -- bandwidth in particular.
The BitTorrent Web site claims that the protocol is a "tool for free speech." Whether that is accurate is a matter for debate, but BitTorrent is certainly a tool for free bandwidth.