Thursday, August 6, 2015

About Hetima Torrent Tracker

hetimatorrent library support tcp tracker server and tracker client function for dart developers.


support following spec
- bep0003
     http://www.bittorrent.org/beps/bep_0003.html
- bep0023
     http://www.bittorrent.org/beps/bep_0023.html

Basic torrent client need tracker server to search peer for download and upload.
When you want to share file,  you use tracker server.

hetimatorrent example: server code


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
a() {
  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();
  });
}

hetimatorrent example: client code


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
b() {
  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}");
    });
  });
}


Source

- hetimatorrent library 

- HetimaTorrentTracker large sample

- Chrome store


-------
kyorohiro work

No comments:

Post a Comment