Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <iostream>
- #include <string>
- #include "libtorrent/entry.hpp"
- #include "libtorrent/bencode.hpp"
- #include "libtorrent/session.hpp"
- #include "libtorrent/upnp.hpp"
- int main(int argc, char* argv[])
- {
- using namespace libtorrent;
- session s;
- error_code ec;
- s.listen_on(std::make_pair(6881, 6889), ec);
- if (ec)
- {
- fprintf(stderr, "failed to open listen socket: %sn", ec.message().c_str());
- return 1;
- }
- add_torrent_params p;
- p.save_path = "./";
- std::string torrent = "1.torrent";
- p.ti = new torrent_info(torrent, ec);
- if (ec)
- {
- fprintf(stderr, "%sn", ec.message().c_str());
- return 1;
- }
- s.add_torrent(p, ec);
- if (ec)
- {
- fprintf(stderr, "%sn", ec.message().c_str());
- return 1;
- }
- // wait for the user to end
- char a;
- scanf("%cn", &a);
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement