简体   繁体   English

用MonoTorrent下载torrent的C#

[英]C# downloading torrent with MonoTorrent

I'm trying to download a torrent with MonoTorrent , the problem is that when i look at the network traffic in wireshark it seems like the client is not even attempting to contact the tracker. 我正在尝试使用MonoTorrent下载一个torrent,问题是当我查看wireshark中的网络流量时,似乎客户端甚至没有尝试联系跟踪器。 It reads the torrent-file correctly and visual studio displays no errors. 它正确读取torrent文件,visual studio显示没有错误。

This is the code i'm using: 这是我正在使用的代码:

public Form1()
{
        EngineSettings settings = new EngineSettings();
        settings.AllowedEncryption = EncryptionTypes.All;
        settings.SavePath = Path.Combine(Environment.CurrentDirectory, "torrents");

        if (!Directory.Exists(settings.SavePath))
            Directory.CreateDirectory(settings.SavePath);

        engine = new ClientEngine(settings);

        engine.ChangeListenEndpoint(new IPEndPoint(IPAddress.Any, 6969));

        Torrent torrent = Torrent.Load("C:/Users/xxx/Google Drive/WindowsFormsApplication1/WindowsFormsApplication1/bin/Debug/kontakt.torrent");

        TorrentManager manager = new TorrentManager(torrent, engine.Settings.SavePath, new TorrentSettings());

        engine.Register(manager);

        manager.Start();
}

I really appreciate any help or if someone knows about some alternative 我非常感谢任何帮助,或者如果有人知道某些替代方案

Your code works for me. 你的代码适合我。 Make sure you didn't create a private torrent. 确保您没有创建私有torrent。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM