Managing Torrents

Version 1 (olivier dufour, 04/08/2009 08:57 AM) → Version 2/18 (olivier dufour, 04/08/2009 08:58 AM)


h1. Client example

<pre><code class="csharp">

<code>

ClientEngine engine = new ClientEngine(new EngineSettings(downloadsPath, port));

//DHT
DhtListener dhtListner = new UdpListener (new IPEndPoint (IPAddress.Any, port));
DhtEngine dht = new DhtEngine (dhtListner);
engine.RegisterDht(dht);
dhtListner.Start();
//byte array of dht nodes
engine.DhtEngine.Start(nodes);

torrent = Torrent.Load("test.torrent");
TorrentManager manager = new TorrentManager(torrent, downloadsPath, torrentDefaults);

//FastResume code need a BencodedDictionnary
manager.LoadFastResume(new FastResume (BEncDictFastResume));

engine.Register(manager);
manager.Start ();

</code>
</pre>