Managing Torrents

Version 1 (olivier dufour, 04/08/2009 08:57 AM)

1 1
h1. Client example
2 1
3 1
<code>
4 1
5 1
ClientEngine engine = new ClientEngine(new EngineSettings(downloadsPath, port));
6 1
7 1
//DHT
8 1
DhtListener dhtListner = new UdpListener (new IPEndPoint (IPAddress.Any, port));
9 1
DhtEngine dht = new DhtEngine (dhtListner);
10 1
engine.RegisterDht(dht);
11 1
dhtListner.Start();
12 1
//byte array of dht nodes 
13 1
engine.DhtEngine.Start(nodes);
14 1
15 1
16 1
torrent = Torrent.Load("test.torrent");
17 1
TorrentManager manager = new TorrentManager(torrent, downloadsPath, torrentDefaults);
18 1
19 1
//FastResume code need a BencodedDictionnary
20 1
manager.LoadFastResume(new FastResume (BEncDictFastResume));
21 1
22 1
engine.Register(manager);
23 1
manager.Start ();
24 1
25 1
</code>