SitePoint Tech Times April 28th, 2004 
Issue 88 

Newsletter Archives | Advertising | Contact us  
Tips, Tricks, News and Reviews for Web Coders

In This Issue...

Introduction

Kevin Yank It's official: our new ASP.NET book is now shipping! And early response from the ASP.NET community tells us we've got a winner on our hands!

Over the past few issues I've talked your ear off about this book, so I'm not going to waste your time by telling you about it all over again. Suffice it to say, I wish I had this book back when I was learning ASP.NET the hard way!

Grab 4 free chapters right now to find out what the fuss is about.

For a change of pace this issue, I decided to cast an eye over the latest in download technology. Read on to learn all about BitTorrent and what it can do for your site.

Happy Reading!

Kevin Yank
techtimes@sitepoint.com
Editor, The SitePoint Tech Times

Top


webEdition CMS: a feature rich CMS for only $249 USD

Box shotManage your Web content efficiently and profitably. webEdition Content Management System has the advanced features that agencies and businesses need to remain competitive in today's marketplace.
Easy-to-use.
Modify your Web pages using your browser
Database-driven.
Harness the power of PHP4 and MySQL
Flexible.
Import/export your data via XML
Interoperable.
Operate across platforms and operating systems
Expandable.
Grow as you wish with over a dozen modules
Affordable.
Achieve a rapid return on your investment
FREE support.
Have confidence! No-fee, technical service
Click here for a 15% discount and start generating revenue now!

Top


Editorial

BitTorrent Finding Legitimacy

Since the advent of Napster (and even before, for those who remember Hotline Connect and its kin), new advances in download technology have struggled to find popularity beyond the realms of software and music piracy. But BitTorrent might just be an idea good enough to make the transition to the mainstream!

BitTorrent is a technology designed to solve the biggest problems with offering downloads:

  • the more people want your file, the more you pay in bandwidth costs
  • sudden demand for a popular file can overwhelm your server
  • if your server goes down, the file becomes unavailable

Old system diagram In traditional download models (e.g. with Web or FTP protocols), a single server sends the download data to anyone and everyone who wants it. This system is nice and simple, but it relies on a single server to have a connection that's fast and reliable enough to handle all requests for the file. It also means that the owner of the server is responsible for the cost of every byte that's downloaded.

New system diagram When BitTorrent is used to download a file, the central server is replaced by a tracker. The tracker doesn't actually host any of the download data; it merely maintains a list of all the clients that wish to download the file. The clients download that list, then communicate directly with each other. This group of clients is called a swarm.

The clients in the swarm trade pieces of the download in a mutually-beneficial fashion. For example, if client A has piece #3 of the file but is missing piece #4, it might notice that client B is missing piece #3. Client A will then send that piece to client B in the hopes that it will return the favour by sending back piece #4. Smart BitTorrent clients can even figure out which other clients offer the best transfer rates and return favours most consistently.

Okay, but if there is no central server, where does the download data come from in the first place? The answer is that the original source of the download file is just another client in the swarm. Once a client finishes downloading a file, it will continue to offer parts of the file to other clients in the swarm. Such "completed" clients are called seeds, and it's generally considered polite to remain in the swarm until your client has uploaded as much data as it has downloaded.

Who Uses It?

BitTorrent is popular in the software and music piracy community because authorities who would like to prosecute the distributor of a file have no easy place to direct their efforts. The tracker doesn't actually distribute the file, and there is no single member of the swarm responsible for distributing it either. Indeed, the original seed will often disconnect from the swarm, once the swarm contains enough data to no longer need the original source.

But the potential of the BitTorrent system extends beyond piracy. Providers of especially large or popular legitimate downloads are beginning to discover the strengths of the BitTorrent model:

  • The more people download your file, the less of that bandwidth comes from your original seed, so bandwidth costs generally stay about constant.
  • Sudden demand for a file merely increases the size of the swarm, which the tracker can handle easily in any realistic case.
  • No single seed going down can damage a healthy swarm, and a temporary tracker outage only prevents new clients from entering the swarm during that time.

The Slashdot community was one of the earliest adopters of BitTorrent technology. Its massive community is famous for taking down even large sites that it links to. This same massive community actually helps to better distribute such files when they're offered as a BitTorrent download.

More recently, the Mozilla Project used BitTorrent to address criticism that its servers could not meet demand caused by a new release of its browser. With the release of Mozilla 1.7 Beta, they offered a BitTorrent download link along with their conventional links.

How Do I Use It?

From the downloader's point of view, BitTorrent can be very simple or quite complex, depending on the client program they choose.

The official BitTorrent client for Windows, Mac OS X and Linux is easy to download and install, and it simply displays a download progress dialog when the user clicks on a BitTorrent download link in their browser. Once the download is complete, the client remains in the swarm as a seed for as long as the progress dialog is left open. The client does request a donation every time it starts up, however, which can put off a lot of first-time users.

A number of excellent third party clients--most of them free--have sprung up to provide better interfaces and more fine-grained control over the download process. My favourite among these, Azureus, is an open source application written in Java. It lets you manage multiple BitTorrent downloads at once, view detailed information about the clients in the swarm, and selectively download or set priorities for individual files in a multi-file BitTorrent download.

As far as offering your own files for download, the hardest part is setting up your own tracker. Azureus has its own built-in tracker if you're just transferring the odd personal file, and the official BitTorrent site offers source code that you can compile to run a tracker on your Web server full time. Some public trackers do exist, but it's hard to find one that's both reliable and reputable.

Once you have a tracker set up, you must use a simple utility (free to download from the official BitTorrent site, or built into Azureus) to generate a .torrent file for your download by feeding it the file(s) you want to offer and the URL of your tracker. Then, simply distribute that file, usually by putting it on your Website. The file contains everything a BitTorrent client needs to know to join the swarm for the download, and downloading it with a Web browser should automatically launch the client and start the download.

Finally, open the .torrent file in your own client, which will become the first seed in the swarm. If you wish to offer the download permanently, you may wish to run a permanent seed on your Web server instead.

The Catch: BitTorrent and Firewalls

For the mutually beneficial piece-trading system to work, the clients in the swarm must be able to connect to each other freely over a range of TCP/IP ports. If BitTorrent has one weakness right now, it's that firewalls can interfere with these connections.

While it's simple enough for a network administrator to open the necessary ports on a firewall, the average home user would find this a challenge--assuming they even know that it needs doing!

A BitTorrent client that is impeded by a firewall will still be able to download; it will just have a much harder time creating relationships with clients in the swarm. As a result, BitTorrent download speeds tend to be rather slow with a firewall in the way.

As BitTorrent clients improve, support for automatically opening ports on firewalls that support it (such as Windows XP's built-in firewall) should improve the experience for non-technical users. In the meantime, however, BitTorrent's use tends to be restricted to technically adept user groups.

Novel Uses: BitTorrent and Blogging

A number of articles have recently been published around the Web (e.g. O'Reilly, Wired) about applying BitTorrent technology to video blogging and other large file, low bandwidth limit situations.

In the first working example of this that I've seen, a site called LegalTorrents offers BitTorrent downloads of freely distributable music. These are large archives of MP3 files, the distribution of which would normally consume a great deal of bandwidth.

By providing RSS feeds of these torrents along with a plug-in for a popular RSS reader that automatically launches BitTorrent downloads, they have allowed their users to gain instant access to the latest music on their site without spending a fortune on bandwidth.

What's Missing?

No one can deny that BitTorrent is a great idea. Even better, it's a great idea supported by a number of free client programs for all popular PC operating systems. So why aren't more people using it?

My gut feeling on this is that the BitTorrent community tends to be a highly technical one. One look at the official BitTorrent Website would scare away all but the most adventurous of nontechnical users.

But if what BitTorrent needs to become a widely adopted technology is spit and polish, the existing BitTorrent community has relatively little interest in providing it. BitTorrent in its current form serves that community very well indeed.

That said, if you need to distribute large or popular files on a limited bandwidth budget, it's worth taking a very close look at BitTorrent.

Top


Subscribe to php|architect and get 18% off!

Subscribe Today!php|architect is the premier PHP magazine for professionals. Each issue comes jam-packed with articles for both intermediate and advanced PHP developers, focusing on all the aspects of day-to-day programming.

Sign up today for php|architect, and get as much as $10 US off the regular subscription price for 12 issues. php|architect is available in both traditional print format or as a PDF - the choice is yours!

Visit php|architect today to claim your discounted subscription

Top


Quick Tip

SQL Server for free... almost!

ASP.NET doesn't have to cost a lot. Frugal developers can run ASP.NET on a Windows 2000 or XP Pro system and code in any text editor. But a development license for SQL Server could still break the bank.

Thankfully, Microsoft offer a somewhat limited - but for development purposes, equally good - version for free download: the SQL Server 2000 Desktop Engine (MSDE).

I wrote about MSDE way back in Tech Times #36, but back then you had to buy one of several pieces of development software from Microsoft to get it. Since the release of ASP.NET, Microsoft have decided to give it away for free.

In the past, you also needed to get hold of the SQL Server administration tools to effectively use MSDE. Although Microsoft aren't yet giving them away, they have provided a Web-based alternative called Web Data Administrator.

For complete instructions on obtaining and installing both MSDE and Web Data Administrator, check out Chapter 1 of Build Your Own ASP.NET Website Using C# & VB.NET on SitePoint or download the first four chapters in PDF format.

Top


Help Your Friends Out

People you care about can benefit from the wealth of information on new and maturing technologies available on the Internet. Help them learn how to do it by forwarding them this issue of the SitePoint Tech Times!

Send this to a friend

Download a full four free chapters from every SitePoint Book!

cover shotBuild Your Own ASP.NET Website Using C# & VB.NET
by Zak Ruvalcaba


cover shotThe PHP Anthology
by Harry Fuecks


cover shotHTML Utopia: Designing Without Tables Using CSS
by Dan Shafer


cover shotBuild Your Own Database Driven Website Using PHP and MySQL
by Kevin Yank

 

!More information about SitePoint Books

 New Technical Articles

Build Your Own ASP.NET Website Using C# And VB.NET, Chapter 1 - Introduction to .NET and ASP.NET

Zak Ruvalcaba
By Zak Ruvalcaba

What is .NET? What is ASP.NET? These questions and more are answered by Chapter 1 of SitePoint's new title, Build Your Own ASP.NET Website Using C# and VB.NET. By the end of this tutorial, you'll know the basics, you'll have the software installed, and you'll have built your first ASP.NET page!

Build an RSS DataList Control in ASP.NET

Philip
Miseldine
By Philip Miseldine

Learn how to create a server control based on the DataList to provide a self-contained and manageable way of consuming RSS feeds within your ASP.NET applications with Philip's step-by-step tutorial.

The Importance of the Hypertext Document Title

Fernando
Freire Báez
By Fernando Freire Báez

The HTML document title should be at the core of your Webmastering arsenal. As Fernando explains, your document's title appears in everything from users' bookmarks lists to their task bars, so it pays to get your title right. Use Fernando's handy tips to create winning titles every time!

Generating Spreadsheets with PHP and PEAR

Harry Fuecks
By Harry Fuecks

So you thought Excel was a proprietary software product beyond the developmental reach of the average open source programmer? Think again! Harry explains the use of PEAR to produce real live Excel spreadsheets in this hands-on tute.

 Hot, Techy Forum Threads
 Techy Blog Entries

PHP Blog:
Dynamically Typed

Open Source Blog:
Open Sourcery

ColdFusion Blog:
The Fuse

Flash Blog:
Go Flash Go!

.NET Blog:
Daily Catch

DHTML & CSS Blog:
Stylish Scripting

Manage Your Subscription Here.

!You are currently subscribed as to the HTML edition of the Tech Times.


CHANGE your email address here

UNSUBSCRIBE from the Tech Times here.

SUBSCRIBE to the Tech Times here.

SWAP to the 'Text-Only' version of the Tech Times here.


SitePoint is Hosted by
Ventures Online


Thanks for reading!

 © SitePoint 2004. All Rights Reserved.

Back to the archives

Newsletter signup

Design, coding, community or marketing? Select the right newsletters right for your needs...