Advertisement
Guest User

Untitled

a guest
Jun 30th, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <iostream>
  3. #include <string>
  4. #include "libtorrent/entry.hpp"
  5. #include "libtorrent/bencode.hpp"
  6. #include "libtorrent/session.hpp"
  7. #include "libtorrent/upnp.hpp"
  8.  
  9. int main(int argc, char* argv[])
  10. {
  11. using namespace libtorrent;
  12.  
  13. session s;
  14. error_code ec;
  15. s.listen_on(std::make_pair(6881, 6889), ec);
  16. if (ec)
  17. {
  18. fprintf(stderr, "failed to open listen socket: %sn", ec.message().c_str());
  19. return 1;
  20. }
  21. add_torrent_params p;
  22. p.save_path = "./";
  23. std::string torrent = "1.torrent";
  24. p.ti = new torrent_info(torrent, ec);
  25. if (ec)
  26. {
  27. fprintf(stderr, "%sn", ec.message().c_str());
  28. return 1;
  29. }
  30. s.add_torrent(p, ec);
  31. if (ec)
  32. {
  33. fprintf(stderr, "%sn", ec.message().c_str());
  34. return 1;
  35. }
  36.  
  37. // wait for the user to end
  38. char a;
  39. scanf("%cn", &a);
  40. system("pause");
  41. return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement