~ubuntu-branches/ubuntu/maverick/libtorrent-rasterbar/maverick

« back to all changes in this revision

Viewing changes to examples/simple_client.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Sauthier
  • Date: 2010-08-10 12:59:37 UTC
  • mfrom: (1.3.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20100810125937-jbcmmf17y8yo9hgz
Tags: 0.15.0-0ubuntu1
* New upstream version.
* debian/patches/100_fix_html_docs.patch: refreshed.
* debian/control: bump up standards-version to 3.9.1 (no changes).

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
                return 1;
55
55
        }
56
56
 
57
 
#ifndef BOOST_NO_EXCEPTIONS
58
 
        try
59
 
#endif
60
 
        {
61
 
                session s;
62
 
                s.listen_on(std::make_pair(6881, 6889));
63
 
                add_torrent_params p;
64
 
                p.save_path = "./";
65
 
                p.ti = new torrent_info(argv[1]);
66
 
                s.add_torrent(p);
 
57
        session s;
 
58
        s.listen_on(std::make_pair(6881, 6889));
 
59
        add_torrent_params p;
 
60
        p.save_path = "./";
 
61
        error_code ec;
 
62
        p.ti = new torrent_info(argv[1], ec);
 
63
        if (ec)
 
64
        {
 
65
                std::cout << ec.message() << std::endl;
 
66
                return 1;
 
67
        }
 
68
        s.add_torrent(p, ec);
 
69
        if (ec)
 
70
        {
 
71
                std::cerr << ec.message() << std::endl;
 
72
                return 1;
 
73
        }
67
74
 
68
 
                // wait for the user to end
69
 
                char a;
70
 
                std::cin.unsetf(std::ios_base::skipws);
71
 
                std::cin >> a;
72
 
        }
73
 
#ifndef BOOST_NO_EXCEPTIONS
74
 
        catch (std::exception& e)
75
 
        {
76
 
                std::cout << e.what() << "\n";
77
 
        }
78
 
#endif
 
75
        // wait for the user to end
 
76
        char a;
 
77
        std::cin.unsetf(std::ios_base::skipws);
 
78
        std::cin >> a;
79
79
        return 0;
80
80
}
81
81