limiting bandwidth with vuze API

121 Views Asked by At

I'm using VUze API to create a JAVA program in order to implement a few experiments on Bittorrent. This code works fine when downloading a torrent

String url = "500mega.torrent";
    core = AzureusCoreFactory.create();
    core.start();
    // System.out.println("Attempting to download torrent at : " + url);

    File downloadedTorrentFile = new File(url);

    System.out.println("Completed download of : " + url);
    System.out.println("File stored as : "
            + downloadedTorrentFile.getAbsolutePath());

    File downloadDirectory = new File("downloads"); // Destination directory
    if (downloadDirectory.exists() == false)
        downloadDirectory.mkdir();
    COConfigurationManager.initialise();
    GlobalManager globalManager = core.getGlobalManager();
    DownloadManager manager = globalManager.addDownloadManager(
            downloadedTorrentFile.getAbsolutePath(),
            downloadDirectory.getAbsolutePath());
    DownloadManagerListener listener = new DownloadStateListener();
    manager.addListener(listener);

    TransferSpeedValidator.setGlobalDownloadRateLimitBytesPerSecond(100);
    System.out.println(TransferSpeedValidator
            .getGlobalDownloadRateLimitBytesPerSecond());
    globalManager.startAllDownloads();

However, I can't find the method to limit the download/upload bandwidth. The documentation for Vuze is so bad... Any help would be greatly appreciated.

Thanks.

1

There are 1 best solutions below

0
On BEST ANSWER

The global speed limits are settings. Which are stored in a String-keyed map for which you can find many defaults in org.gudy.azureus2.core3.config.impl.ConfigurationDefaults.ConfigurationDefaults().

Since the settings are all stored in a singleton they can be set through static methods such as org.gudy.azureus2.core3.config.COConfigurationManager.setParameter(String, int)

Note that those are internal APIs. They're fairly stable but less so than the plugin APIs.