arvidn / libtorrent

an efficient feature complete C++ bittorrent implementation

Home Page:http://libtorrent.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Downloading a .torrent file from a specified source?

master255 opened this issue · comments

commented

@arvidn I have integrated file downloading with Libp2p via url_seed. To fully work through Libp2p I still need to download a .torrent file. What is the best way to do it? Should I download the .torrent file via url_seed too?
Right now no http requests are received while there is no .torrent file.

commented

Okay. I found it can be done this way:

final torrent_info torrentInfo = new torrent_info("path_to_torrent.torrent", errorCode);
downloadedTorrentHandle.swig().set_metadata(new create_torrent(torrentInfo).generate().get("info").bencode());
commented

Another way:
Vectors.byte_vector2bytes(foundedHandle.write_resume_data(torrent_handle.save_info_dict).get("info").bencode())