Jump to article
< >

Active GUI element

Static GUI element

Code

WPS object

File/Path

Command line

Entry-field content

[Key combination]

more

BitTorrent and OS/2
Part 2

by Alex Taylor, © May 2007

BitTorrent is a popular peer-to-peer file distribution protocol. In this followup to my original article on BitTorrent and OS/2, I address a few outstanding issues and take a look at some additional BitTorrent solutions.

Introduction

Back in 2004, I wrote an article outlining how to use the BitTorrent peer-to-peer protocol to download files under OS/2.

Since that time, the available BitTorrent software has progressed considerably, and I've also gained a bit more experience with it. So I've decided that it's time to write a follow-up article touching on some of these things.

The Python Client

My original article (and the accompanying launch script) was based on version 3.4.2 of the official Python-based BitTorrent client. At the time of writing, the official client (now located at www.bittorrent.com) is up to version 5.x.

Unfortunately, there seem to be some problems with using versions after 3.x on OS/2. Version 4.0.x seems to more or less work as long as only one instance is running (although on my system it pegs the CPU at 100%). However, attempting to download more than one torrent causes it to hang indefinitely.

Later 4.x and 5.x versions do not function at all, apparently because they rely on a Python module called twisted, which has not yet been ported to OS/2.

None of these later versions work with the launch script (BT_GET.CMD) that I provide, since the command-line syntax for the BitTorrent client has changed a few times since version 3. Version 4.0.x can be made to work (with the limitations mentioned above) by making a couple of minor changes to the line which executes BitTorrent; I have decided not to include those changes here, given the outstanding issues with version 4 in general.

For these reasons, OS/2 users are pretty much obliged to either stay with version 3.4.2, or else use a different client such as BitTornado (see below). Personally, I recommend the latter.

Versions of Python/2

I've tried BitTorrent with several different releases of Python for OS/2, with differing results for each.

Python 2.3.5 (EMX port)

This is the final 2.3.x Python release, currently available from Andy MacIntyre's web site. It works pretty well with BitTorrent, although occasionally it does crash; I suspect this is probably due to limitations within EMX (which is, after all, is getting pretty old these days). It does not, regrettably, allow support for files larger than 2 GB, which may be a problem if you want to download such files.

Python 2.4.x (EMX ports)

The current version of Python 2.4.x is also available from Andy's web site. This doesn't seem to work quite as smoothly with BitTorrent as 2.3.5; specifically, the output screen has a tendency to fill up with nasty-looking error messages. The actual BitTorrent download appears to function (at least for the short periods of time that I've kept it running), although the status display is largely obscured by the error messages. Like 2.3.5, it does not support files larger than 2 GB.

Python 2.4.3 (Innotek GCC port)

Andy has an experimental build of version 2.4.3 that was compiled using the Innotek compiler. In theory, this should be preferable as it eliminates many of EMX's shortcomings. Unfortunately, it won't work with the normal BitTorrent client at all, because it doesn't include the curses module. (It may work with the “headless” command-line BitTorrent client, which is included in the BitTorrent and BitTornado packages, but this is impractical to use as it does not seem to support configuration parameters.)

I therefore recommend going with Python 2.3.5 if you use BitTorrent 3.4.2, or the latest EMX port if you use BitTornado… and just living with their limitations.

Other Clients

The official BitTorrent implementation is not the only one, of course. I'll briefly touch on a few others that seem to run under OS/2.

BitTornado

BitTornado is an alternative Python-based BitTorrent client which was forked from the official client some time ago. It has more or less kept pace with the official client in terms of functionality, but has the distinct advantage that the latest versions actually work under OS/2.

Since BitTornado is based on the official client, it is invoked in the exact same way as BitTorrent 3.4.2; indeed, you can use my BT_GET.CMD script for BitTornado without any extra effort. First, make sure you download the source package (not the Windows installer)—at the time of writing this is BitTornado-0.3.18.zip. Then, simply proceed as I described in my last article:

Thus far, I've had no problems with BitTornado, apart from the occasional (and apparently harmless) warning message about Too many MuxWait semaphores.

CTorrent

CTorrent is a command-line BitTorrent client written in C, which touts itself as a fast, 'no-frills' client. It runs in plain-text mode, and produces rather terse and simple output. There is an OS/2 port available on Hobbes. Source code is provided.

CTorrent consists of a single executable, and has no external dependencies that I'm aware of. Invoking it is as simple as:

ctorrent [ parameters ]

The list of supported parameters is available by running ctorrent -h. At a minimum, you should specify the name of a torrent file.

By default, CTorrent listens on a different IP port range than the official Python client. Instead of starting at port 6881 and counting up to 6999, it starts at port 2706 and counts down to port 2106. You can, of course, specify different ports using CTorrent's command-line parameters. As always, if you have a firewall or broadband router, you should make sure that this port range is passed through to your local system.

Unlike the official Python client, CTorrent seems to allocate filesystem storage for files as soon as it starts downloading them. (For instance, when downloading a 200 MB file, that file will occupy the full 200 MB of disk space from the moment that CTorrent starts the download.) This does have one disadvantage, in that you cannot differentiate between complete and partial files simply by browsing the directory; you must refer to CTorrent itself (which means running it again if it was interrupted) to keep track.

I have not tested CTorrent to any significant extent. I've verified that it runs, and it appears to work with some trackers. Unfortunately, it does not work with the tracker I connect to most often: all connection attempts fail with the error message This torrent is not allowed on this tracker (although the same torrents work perfectly well with the official BitTorrent client).

CTorrent itself has not been updated in some time. However, there is a forked version called Enhanced CTorrent which receives active development. Enhanced CTorrent appears to provide a number of fixes and other features over and above the original CTorrent, such as support for files over 2 GB, and the ability to give priority to individual files within a torrent.

An OS/2 port is available here. Unfortunately, it produces the same error message as the original CTorrent when connecting to certain trackers.

The Hunting of the Snark

The Hunting of the Snark is a simple BitTorrent client and server written in Java, which describes itself as an “experimental” implementation. It runs in a plain-text mode similar to CTorrent (there is a GNOME-based GUI available, but not for OS/2).

The download consists of one file, snark.jar, which is executed using Java as follows:

java -jar snark.jar [ parameters ]

This assumes that Java is in your PATH, of course. The parameters are described on the program web site.

By default, The Hunting of the Snark listens on the same range of IP ports as the Python client (6881 to 6999); you can change this from the command-line. Once again, make sure that these ports are visible to the outside world.

Like CTorrent, The Hunting of the Snark seems to allocate storage for the entire file as soon as it starts downloading.

I have not tested The Hunting of the Snark extensively either; it appears to run using Innotek Java 1.4.2, and I have verified that it will at least start downloading a torrent, but that is all I can say for certain.

None of the above

There are a great many other BitTorrent clients out in the wild, written in a variety of different languages for various platforms. Those I've described are the only ones that I have personally confirmed as OS/2-compatible, although there may be others.

A Note About Azureus

One of the most popular BitTorrent clients available is Azureus. Besides having a slick graphical interface, Azureus offers a number of features not available in most other BitTorrent clients. It's written in Java, and is often touted as being platform-independent. So you'd think it would run on OS/2, wouldn't you?

It does not.

Contrary to popular perception, Azureus isn't a “pure” Java application. It uses a platform-dependent programming library known as SWT (from the Eclipse project), which unfortunately is not (yet) available for OS/2.

Arctic Torrent (a minimal Windows BitTorrent client) appears to run under Odin, although it pegs my CPU at 100%. I haven't actually downloaded anything with it.

Launch Scripts

In my last article, I provided two launch scripts: BT_GET.CMD, which is the main script for modern OS/2 systems; and an alternate BT_GET2.CMD for use with older OS/2 versions which do not support the “extended LIBPATH” (a.k.a. BEGINLIBPATH / ENDLIBPATH) feature.

I had assumed at the time, based on IBM's documentation, that the extended LIBPATH (and the corresponding REXXUTIL support) was not available until Warp Server for e-business (or Warp 4 FixPak 13+). I've since realized that, in fact, this support was added to OS/2 as early as FixPak 35 for Warp 3, and FixPak 6 for Warp 4. IBM just didn't bother to document it until WSeB was released.

Therefore, I've decided not to maintain or support BT_GET2.CMD anymore; I don't really see how anyone would need it. If you're running Warp 3, Warp Connect, Warp Server, or Warp 4, BT_GET.CMD should work just fine as long as FixPak 35/6 (or higher) is installed.

The latest version of BT_GET.CMD (version 1.02 at the time of writing) is available on my web site. Since the first release, I have added the option to change the IP ports used by BitTorrent; these are specified in REXX variables near the top of the file.

Conclusion

Like all actively-developed software, BitTorrent continues to evolve. I am reasonably hopeful that OS/2 users will not get left behind (as they so often have been), even though there are some worrying signs.

I plan to continue keeping an eye on BitTorrent and the various aspects of running it under OS/2. If anybody else has (or discovers) anything more to add to what I've discussed here, feel free to contact me.

Editing: James Moe
References

BitTorrent (official website): http://www.bittorrent.com
Python for OS/2: http://members.pcug.org.au/~andymac/python.html
BitTornado: http://bittornado.com/
CTorrent: http://ctorrent.sourceforge.net/?action=what
Enhanced CTorrent (OS/2 port): http://eros2.by.ru/miscfiles_en.shtml
The Hunting of the Snark: http://klomp.org/snark/
BT_GET: http://www.cs-club.org/~alex/programming/rexx/#bt_get