Discussion:
[libtorrent] Libtorrent-discuss Digest, Vol 131, Issue 13
Viren Negi
2017-04-17 13:15:39 UTC
Permalink
Taken reference from the http://libtorrent.org/examples.html. I modified to
code to look like this

add_torrent_params p;
....
....
sha1_hash t1;
if(from_hex(argv[1], 40, (char *)&t1[0])) {
p.info_hash = t1;
std::cout << "Got here" << std::endl;
}
else {
std::cout << "invalid info-hash" << std::endl;
exit(1);
}

I still don't see it working.





On Sun, Apr 16, 2017 at 5:31 PM, <
Send Libtorrent-discuss mailing list submissions to
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
or, via email, send a message with subject or body 'help' to
You can reach the person managing the list at
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Libtorrent-discuss digest..."
1. Re: Any specific reason as to my INFO-HASH to
add_torrent_params does starting a torrent download (Arvid Norberg)
----------------------------------------------------------------------
Message: 1
Date: Sat, 15 Apr 2017 20:31:00 -0700
Subject: Re: [libtorrent] Any specific reason as to my INFO-HASH to
add_torrent_params does starting a torrent download
To: General discussion about libtorrent
gmail.com>
Content-Type: text/plain; charset=UTF-8
Hi,
I have improvised the simple_client.cc to extend the torrent to accept
magnetic link and info_hash
While I see the magnetic link stuff work but when I try with info hash I
don't any satisfactory result.
Here a git diff of actual modification I made to simple_client.cc
https://gist.github.com/anonymous/977a393a03ad01523f210b1046afc054
<https://gist.github.com/anonymous/977a393a03ad01523f210b1046afc054>
Not sure what I'm doing through. The example on how to use a info_hash in
add_torrent_params is taken from python example.
https://github.com/arvidn/libtorrent/blob/master/
bindings/python/src/session.cpp#L247-L248
I think I making a some stupid mistake but I'm not able to figure that
out.
I suspect you pass in the info-hash hex encoded on the command line, you
p.info_hash = sha1_hash(argv[1]);
You need to decode it into binary. I believe, with proper escaping, you
could pass the info-hash as binary on the command line, except for a 0,
which likely would be interpreted as a string terminator at some point.
--
Arvid Norberg
------------------------------
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
------------------------------
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
End of Libtorrent-discuss Digest, Vol 131, Issue 13
***************************************************
Loading...