view · edit · print · history

CTorrent Control Server (CTCS) is an interface for monitoring and managing Enhanced CTorrent clients. It can manage allocation of bandwidth, provide status information, and allow changes to the running configuration of each client. Communication with CTorrent is via a TCP connection, and the user interface is a web browser.

CTCS was developed by Daniel Holmes, the creator of Enhanced CTorrent. The original sources are available at http://www.rahul.net/dholmes/ctorrent/ctcs.html.

The current version available for Optware is 1.4.1.


If you want to install it, just update the list of packages available for ipkg and then install it:

ipkg update
ipkg install ctcs

Init script

The package for the nslu2 includes a init script that starts CTCS when the slug boots. It is located at /opt/etc/init.d/S90ctcs. If you want to change any command line option, you can change the script and restart it.

The script starts CTCS in the background using the default port (2780) and redirects all output to /dev/null. CTCS writes messages to the console, something unappropriate for a server running in the background. If you want to log the output, then change the destination at the init script.

If you upgrade to the latest version of CTCS and you have edited your init script, ipkg will warn you about the changed file with a message like this:

Installing ctcs (1.3-8) to root...
    Configuration file '/opt/etc/ctcs.conf'
    ==> File on system created by you or by a script.
    ==> File also in package provided by package maintainer.
       What would you like to do about it ?  Your options are:
        Y or I  : install the package maintainer's version
        N or O  : keep your currently-installed version
          D     : show the differences between the versions (if diff is installed)
     The default action is to keep your current version.
    *** ctcs.conf (Y/I/N/O/D) [default=N] ?

Since the command line options have not changed in version 1.2, you can safely keep your modified file by answering "N" or "O".

Command line options

ctcs [-d <dlimit>] [-u <ulimit>] [-i <interval>] [-p <port>] [-P]

-d dlimit
    Overall download bandwidth limit, in KB/s (default 100). 

-u ulimit
    Overall upload bandwidth limit, in KB/s (default 25). Use a value 
    that is less than the maximum capacity of your network line. 

-i interval
    Bandwidth management change interval, in seconds (default 5). The 
    recommended minimum value is 3. Higher values will reduce 
    oscillation of individual torrent limits, but a value that is too 
    high will cause very slow reactions to changes in bandwidth usage. 

-p port
    The TCP port on which to listen for connections (default 2780). 

    Prompt for an authorization password. 


CTCS has an option ("-P") to prompt for a password when the server starts. This password is then used to authenticate Enhanced CTorrent clients, but not for web browser authentication. If you are using the init script provided by the package, you will not be able to use this option, since CTCS will be started from the init script with no user intervention.

Using Enhanced CTorrent with CTCS

When you start Enhanced CTorrent, the -S option tells it to use CTCS. An example is given in the Enhanced CTorrent page.

Known issues

These are the known issues, as of August 13, 2006:

  • CTCS has only been tested on the NSLU2, but since it is just a Perl script, chances are it will work fine in other platforms. Testers are welcomed.
  • There is a problem that causes the server to quit unexpectedly sometimes. This should not happen after a fix introduced in version 1.1-5, but there are some reports of this problem still showing up. I believe there is an issue with the re-use of port numbers by other processes in the slug, mainly the ctorrent clients.
    A simple measure to avoid this problem is to run CTCS on a reserved port. Any unused port number below 1024 should work, in my case I'm using port 980. You'll need to edit /opt/etc/ctcs.conf, changing ctcs_port to the new number and also adjust the -S parameter used in the command line to enhanced-ctorrent.

Dynamic bandwidth eventually slows download(s)& uploads --> Work-Around:

SRS 07/19/2009

UnSLung 6.10 Enhanced-CTorrent dnh3.3.2 ctcs 1.4.1

With one or more torrents downloading from high speed seeders running CTCS set all torrents Shared-DL and Minimum-DL Maximum-DL set to 0 [ 0 to disable/remove a limit ] and global bandwidth set plenty high enough to accommodate.

What happens is that after an indeterminate period of time ( typically 30 minutes to several hours) one ( or more ) torrent(s) will slow to 8kB/s or less. IF now disable Shared-DL on all and set Current.Limit-DL to 0s the download speeds are OK.

If set to Shared-DL on any of the slowed/stalled torrent the 8kB/s limit returns. Backed to disabled Shared-DL download speed OK again.

This has been confirmed over a period of several months on 2 separate NSLU2s at different locations/IP providers and different trackers.

With Shared-DL on and setting the Minimum-DL to anything greater than 8kB/s always results in an 8kB/s or less speed with any of the slowed torrents.

With Shared-DL off and setting the Current.Limit-DL to anything greater than 8kB/s always results in an 8kB/s speed or less with any of the slowed torrents.

The UpLoad dynamic management encounters nearly identical problems. ** FIX is the same as for DL; Disable Shared-UL on all and set Current.Limit-UL to 0s the upload speeds are OK.

With Shared-UL on and setting the Minimum-UL to anything greater than 4kB/s always results in an 4kB/s or less speed with any of the slowed torrents.

With Shared-UL off and setting the Current.Limit-UL to anything greater than 4kB/s always results in an 4kB/s speed or less with any of the slowed torrents.

Also note that with both Shared-DL AND Shared-UL ALL set to off that the download speed may then become limited to that of the uploads total speeds. This may be because most BitTorrent peers use a variant of Tit for two Tats which is called optimistic unchoking in BitTorrent terminology. BitTorrent peers have a limited number of upload slots to allocate to other peers. Cooperation is achieved when upload bandwidth is exchanged for download bandwidth. Consequently, when a peer's upload bandwidth is saturated, it will use a Tit for Tat strategy. Optimistic unchoking corresponds very strongly to always cooperating...

Because of this you may not want to Disable Shared-UL on all until downloads are complete.


view · edit · print · history · Last edited by SRS.
Based on work by SRS, fcarolo, and fishead.
Originally by fcarolo.
Page last modified on August 02, 2009, at 11:11 AM