Return to site

About tracker sample.

HetimaTorrent supprt trakcer server and client function.
support following spec
- bep0003
http://www.bittorrent.org/beps/bep_0003.html
- bep0023
http://www.bittorrent.org/beps/bep_0023.html
server_side() {
  TrackerServer trackerServer = new TrackerServer(new HetiSocketBuilderChrome())
  ..address = "0.0.0.0"
  ..port = 6969;
  //
  trackerServer.start().then((StartResult result) {});
    List<int> infoHash = new List.filled(20, 1);
    trackerServer.addInfoHash(infoHash);
    new Future.delayed(new Duration(minutes: 30)).then((_) {
      trackerServer.stop();
});
}
client_side() {
  TorrentFile torrentfile = null;
  // ..
  //create Torrent file Object from blob;
  // ..
  TrackerClient.createTrackerClient(new HetiSocketBuilderChrome(), torrentfile).then((TrackerClient client) {
    client.downloaded = 0;
    client.uploaded = 0;
    client.event = TrackerClient.EVENT_STARTED;
    client.requestWithSupportRedirect().then((TrackerRequestResult result) {
      print("${result}");
    });
  });
}
All Posts
×

Almost done…

We just sent you an email. Please click the link in the email to confirm your subscription!

OKSubscriptions powered by Strikingly