CTorrent Control Server
CTorrent Control Server (CTCS) is an interface for monitoring and managing
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.
The current version is implemented in Perl
since that was used to develop the original prototype. It may be
reimplemented in C at some later date, but the Perl version is fully
functional. You will need to install a Perl interpreter if your system does
not already have one.
The preferred download mechanism is now the
SourceForge File Release page. All new files will be available there for
convenient downloading from a mirror site near to you.
CTCS version 1.4.1. List of changes:
Additional color-coding of peer interested/choked status
Fixed error displaying Torrent Details screen when a file has zero size.
Fixed problems handling POST form input.
Boost client's limit only if bandwidth is shared.
On details screen for terminated torrent, Torrent table showed "Start Time".
CTCS version 1.4. List of changes:
Protocol 3 support
Auto-configuration of client configuration options
File download priority
Updated block start messages for consistency
New client configuration options as provided by client version 3.1 and later.
Each file's download priority is shown in the list and can be set as an
alternative method to changning the "-n" option value.
CTCS version 1.3. List of changes:
Protocol 2 support
Cache size configuration option
Removal of option to exit when peers=0
Total seeders & leechers in the swarm, and connecting peers, are shown.
File availability is shown.
Bandwidth management changes
Works correctly with Enhanced CTorrent dnh3
Adjusted the threshold for increasing a limit
Wait a few minutes after a client becomes seed to reduce the download
limit. This allows duplicate slices still "in flight" to be received and
thus cleared from the connection.
The average bandwidth available per client is now regarded as an implied
minimum. A client limit will generally not be reduced below this value,
though unused bandwidth will be allocated to other clients. This avoids a
slow and difficult ramp-up period when an idle client suddenly acquires an
Configuration values are highlighted at certain times for visibility or
Zero peer rates and transfer amounts are not shown, for clarity.
Peer completeness is shaded red by value (0%=red, 100%=white).
Uninterested states are indicated in gray.
Peer IP address is centered in the cell.
Peer transfer rates and totals are shaded purple by scale (B/K/M).
CTCS version 1.2. List of changes:
Version number is now displayed at bottom of main page.
Added a few client ID strings.
The maximum limit "boost" value is now based on the global limit and number
of torrents. Previously it was always 1K; now it will be less if bandwidth
Improved handling of minimum limits. Now a torrent's limit will never be
reduced below its minimum, but unused bandwidth will still be borrowed for
other torrents. This is more stable with the new seeding algorithm.
Eliminated the checkboxes to change current limits on the Advanced Limits
screen. Each limit is changed only if a new value is entered for it.
Added an option to limit a torrent's max upload rate based on share ratio.
(See the Advanced Limits screen.)
In the Advanced Limits screen, options related to downloading are now
disabled for torrents that are seeding.
An exclamation point (!) is shown next to the torrent title if messages are
present. The torrent title is highlighted based on message severity.
Messages that include a severity (added in dnh2.2) will be highlighted in
red (sev 1) or yellow (sev 2). Sev 3 and no-severity (pre-dnh2.2) messages
are not highlighted.
Enabled a Torrent Details page for terminated torrents.
Avoid crashing if a user stops/reloads too quickly.
Resolved with a SIGPIPE handler, which may not work on all platforms. If
you know how to handle this situation on your platform, please let me know.
I found that checking the return code from print/printf was not particularly
If the hostname is unresolvable, the program will now fall back to
"localhost" or 127.0.0.1. Previously this could result in an error.
Cleaned up HTML print statements (code formatting).
CTCS version 1.1. List of changes:
Use "\r\n" as newline.
Added a few client ID strings.
Fixed data sending (user interaction) on Linux.
Fixed error when all upload or download limits are zero.
CTCS version 1.0a
Patch file for 1.0
There was a minor bug in the original release that prevented the
Messages feature from working (messages were discarded). If you
previously downloaded version 1.0, please apply this small patch to
enable the feature.
ctcs [-d <dlimit>] [-u <ulimit>] [-i <interval>] [-p <port>] [-P]
If your system does not have perl available at /usr/bin/perl, you will
need to change the path in the first line of the file.
- -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.
To connect Enhanced CTorrent (release dnh2 or later) clients to CTCS,
use the "-S" command-line option, e.g. "-S localhost:2780". To use a
web browser to view or change status, enter the same host and port as
the location, e.g. "http://localhost:2780/".
Though there is a basic option, security is very minimal.
Running CTCS on a computer or network with untrusted users is not
recommended. It should go without saying that the CTCS listening port
should not be made openly accessible from the public Internet (but there,
it's said anyway).
The "-P" option will cause CTCS to prompt for a password when starting.
This password will be used to authenticate CTorrent clients. It is
intended that the same password will be used to authenticate web
browser connections also, but this has not yet been implemented.
Using a colon at the end of the -S parameter to CTorrent (as in "-S
localhost:2780:") will cause the client to prompt for a password to
send to CTCS when connecting.
This is the main CTCS display, which shows overall bandwidth status
and provides a summary of each torrent.
The top portion of the display provides the bandwidth management
The current aggregate download and upload rates are shown at the left
(determined by adding together the rates reported by each client). To
the right of this the overall limits and change interval can be changed.
To do this, enter the desired values and click the Change button.
The Advanced Limits function is covered further below.
The next section of the display is a list of all active clients that
are reporting to CTCS, and status information on the torrents they are
||DL Rate||UL Rate
||DL Total||UL Total
||Tue Jan 3 21:24:27 2006|
|S: 0/3||L: 7/7||100%
||D= 0 B/s||U= 11 K/s
||D= 393 M||U= 1111 M
||0 / 11 K/s|
||Tue Jan 3 20:24:06 2006|
|S: 0/25||L: 44/52 +2||100%
||D= 0 B/s||U= 12 K/s
||D= 380 M||U= 972 M
||0 / 12 K/s|
||Wed Jan 4 22:13:55 2006|
|S: 1/2||L: 1/2|| 20% (100% Avail)
||D= 7372 B/s||U= 12 K/s
||D= 188 M||U= 254 M
||100 / 12 K/s|
Each torrent is listed in blue along with the time the client was
started, with its status information shown
below it in white. The first two fields are the number of seeders
and leechers connected (out of the tracker's totals), plus connections
in progress if any. This is followed by the percentage of the torrent
that you have; if it is not complete then the amount that is currently
available from all connected peers is shown in parentheses. The
current download and upload rates are shown in bytes, kilobytes, or
megabytes per second, as are the total amounts downloaded and uploaded
by the client. The bandwidth allocated to the client is shown in the
last column, in kilobytes per second. Note that bandwidth is managed
to a finer degree than this, so if you see a zero value it just means
that less than 1K has been allocated. This is also why it may appear
that the total is wrong if you add the displayed values yourself.
Clicking a torrent title will take you to the Torrent Details screen
for that torrent. If CTCS has received any status messages from a
client, an exclamation point (!) will be shown next to the
title. If there are potentially severe messages, the title will be
highlighted in yellow or red. (If the client is an older version not
supporting severity, the title will be highlighted in yellow when any
messages are present.) These messages can
be read on the Torrent Details screen. Bandwidth limits may also be
highlighted in yellow or green if they have been adjusted on the
Advanced Limits screen.
The "Show peers" option will list each torrent's peers below the
torrent's status information. For more information, see the Torrent Details
screen description below.
Clients that have disconnected from CTCS (assumed to have terminated)
are listed in the lower portion of the display.
This is just like the list of active torrents except that the end time
replaces the start time. The last known status information is shown,
which is normally the final status unless the client terminated
abnormally (crashed). The Torrent Details screen (click the title) is
an abbreviated version, allowing you to see the share ratio and any
To remove a torrent from the list, check the box next to it and click
the Delete button at the bottom left of the list. To clear the entire
list, click the Delete All button at the bottom right.
This screen shows detailed information about a particular client.
Upload/Download Ratio: 2.83
Seed time remaining: 54 hours 11 minutes
If nothing has been downloaded, the full size of the torrent is used
as the amount downloaded; if you are only seeding, then the ratio
effectively shows how many times you have uploaded the torrent.
The time remaining is an estimate based on the current download rate,
current upload rate and target ratio, or actual seed time remaining.
Several configuration parameters can be changed in this part of the
Note that the available options and their descriptions are now determined
by the client and are only presented by CTCS. For details, see the
Enhanced CTorrent User's Guide (command-line options and operator menu).
For parameters that have a corresponding command-line option, the
option letter is shown in brackets next to the parameter name.
Certain items may be highlighted when active or to draw attention;
this does not indicate a problem.
Note that for "Seed time" an approximation of the number of hours
remaining is shown, and a new value entered will be interpreted the
same way. While a decimal value may be shown, the current client will
use only the integer portion of any new value entered.
The total number of seed hours (as it would have been given
on the command line when starting the program), of dubious
usefulness, is given in parentheses.
Other features are:
- Pause torrent
- This will cause the client to temporarily stop transferring data
(uploading and downloading torrent content).
- I/O channel redirection
- The targets for the console input and output channels can be changed.
This section allows you to cause the client to perform an action.
- Force a normal update connection to the tracker.
- This may be handy if messages from the tracker indicate that your client is
no longer registered. You will connect to the tracker as if the client
- Stop the client in a normal manner (as when seeding has completed or the
user hits control-c). This option is tinted red to help avoid
If any status messages have been received from the client, they are
listed next. Messages are color-coded according to severity (supported
with Enhanced CTorrent dnh2.2 and later).
To acknowledge the messages (which clears the list from CTCS memory),
click the Clear button.
The component files of the torrent are listed next.
Due to the complexity of these options, usage notes are displayed
directly on the screen:
- All values are in kilobytes per second (KB/s).
- Options related to downloading are disabled for torrents that are seeding.
- Use caution when changing current limits to below the current rate--small
increments are recommended.
- "Minimum" and "Maximum" are soft limits. They will be enforced when there
is competition for bandwidth; otherwise the torrent is free to give or take
- Minimum: If the torrent wants bandwidth up to this level, it will
receive it at the expense of other torrents. It will not be forced or
held below this level if it wants (is using) the bandwidth. Use to
high-prioritize a torrent, or to guarantee a bandwidth allocation amount
to a torrent.
- Maximum: The torrent will be forced down to this level if other
torrents want bandwidth. Use to low-prioritize a torrent, or to limit the
amount of bandwidth this torrent is allowed to consume at the expense of
- SR: The maximum upload limit will be adjusted based on the torrent's
seed ratio ("-E" option, shown), current share ratio, and current
download rate. It will not be increased above the Maximum or decreased
below the Minimum, if specified. This option does not apply when seeding,
and has no effect if the seed ratio is unset (zero). Use to avoid giving
away too much upload bandwidth when you have other torrents running that
could use it more fairly.
- "Shared" indicates whether the torrent's bandwidth is counted against the
shared pool represented by the global limit on the main CTCS page. CTCS will
dynamically manage the client's bandwidth only if the Shared option is
- Use a value of 0 to disable/remove a limit.
- Non-default settings are highlighted in yellow and green. The limit field
in torrent status displays will also be highlighted as a reminder. Red
highlight indicates an unknown value; you should refresh before making
- After submitting changes, you may need to refresh the page after a second
or two in order to see the resulting updates.