| 1 | #include <libtorrent/session.hpp>
|
|---|
| 2 | // Remove any of the two following includes
|
|---|
| 3 | // and the crashing will stop
|
|---|
| 4 | #include <pion/net/HTTPBasicAuth.hpp>
|
|---|
| 5 | #include <pion/net/HTTPResponseWriter.hpp>
|
|---|
| 6 |
|
|---|
| 7 | int main(int argc, char* argv[])
|
|---|
| 8 | {
|
|---|
| 9 | using namespace libtorrent;
|
|---|
| 10 | #if BOOST_VERSION < 103400
|
|---|
| 11 | namespace fs = boost::filesystem;
|
|---|
| 12 | fs::path::default_name_check(fs::no_check);
|
|---|
| 13 | #endif
|
|---|
| 14 |
|
|---|
| 15 | if (argc != 2)
|
|---|
| 16 | {
|
|---|
| 17 | std::cerr << "usage: ./simple_client torrent-file\n"
|
|---|
| 18 | "to stop the client, press return.\n";
|
|---|
| 19 | return 1;
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | #ifndef BOOST_NO_EXCEPTIONS
|
|---|
| 23 | try
|
|---|
| 24 | #endif
|
|---|
| 25 | {
|
|---|
| 26 | session s;
|
|---|
| 27 | s.listen_on(std::make_pair(6881, 6889));
|
|---|
| 28 | add_torrent_params p;
|
|---|
| 29 | p.save_path = "./";
|
|---|
| 30 | p.ti = new torrent_info(argv[1]);
|
|---|
| 31 | s.add_torrent(p);
|
|---|
| 32 |
|
|---|
| 33 | // wait for the user to end
|
|---|
| 34 | char a;
|
|---|
| 35 | std::cin.unsetf(std::ios_base::skipws);
|
|---|
| 36 | std::cin >> a;
|
|---|
| 37 | }
|
|---|
| 38 | #ifndef BOOST_NO_EXCEPTIONS
|
|---|
| 39 | catch (std::exception& e)
|
|---|
| 40 | {
|
|---|
| 41 | std::cout << e.what() << "\n";
|
|---|
| 42 | }
|
|---|
| 43 | #endif
|
|---|
| 44 | return 0;
|
|---|
| 45 | }
|
|---|
| 46 |
|
|---|