File Sharing Shenanigans
BlitzMax Forums/Brucey's Modules/File Sharing Shenanigans
| ||
This little example downloads a PDF of the Art of War, from the internet somewhere :SuperStrict Framework BaH.Libtorrent Import BRL.StandardIO Local session:TSession = New TSession session.listenOn(6881, 6889) Local params:TAddTorrentParams = New TAddTorrentParams params.setSavePath("./") params.setTorrentInfo(TTorrentInfo.Load("artofwar.torrent")) session.addTorrent(params) ' wait for the user to end.. Input "enter to end..." I'm almost tempted to throw away Vuze now :-p The most trouble I've had is finding legal torrents to test with... pah! |
| ||
Really? Most Linux distro's are available through bittorrent :). |
| ||
Really? Most Linux distro's are available through bittorrent Let me rephrase that : The most trouble I've had is finding legal torrents, that weren't the size of CDs, to test with. :-p |
| ||
I'm also loathed to use Graphics to run the examples in... but then my options are otherwise fairly limited - to basic console output or a GUI module. Perhaps I'll knock up a little CEGUI-based app for the bigger example (with realtime stats and such). |
| ||
Hi, Brucey. Here's a small Linux distro for you to test: http://www.damnsmalllinux.org/download.html Just scroll down to the Bittorrent Mirror section. :) |
| ||
Thats great! :) Thanks alot Brucey! |
| ||
Still writing the "client example" app : which is taking a while, to say the least... ..but it does have the advantage of also testing out all the various parts of the API - to show up any "Brucey" errors. |
| ||
Before anyone (xlsior :-p ) jumps in to mention that it doesn't build on Windows... that's because I've been working exclusively on Mac until now, and I've only just committed it - and now I'm off to bed. Hopefully, it will be working on all platforms within the next few days - assuming it does actually work at all on MinGW... ho ho... Notes : since it is built on Boost, unsurprisingly, it requires BaH.Boost (latest from SVN). It also requires SSL, which I may need to add support on Win32 via BaH.Crypto. The main example also requires BaH.Format. I do find that It is nice, over time, to be able to utilise many other modules in new projects :-) |
| ||
<crickets chirping> ;-) |
| ||
Righty. I appear to have it working on Win32 now :-) I'm still in the middle of writing the example, but it runs as-is. Not all of the "toggle options" show more information yet, ("a" and "i" so far, iirc). So, plenty to do there. As the first post shows, you don't need much code to handle a torrent, but if you want more information, you need to hit the APIs. Win32 requires BaH.Boost and BaH.Crypto (for SSL). You will also need the OpenSSL DLLs. (for all that encryption and hashing stuff). As for the (rather) lengthy module build times... that's just how it is, I'm afraid. |
| ||
As for the (rather) lengthy module build times... Yes indeed ! It reminds me a bit CeGui for that :p BaH.Format is also needed in order to use the client_test.bmx example. By the way OpenSSL libeay32.dll and libssl32.dll (I needed to rename this one ssleay32.dll for some reasons) aren't present in the module. Don't know if you can include them but that would be handy for Win32 users. But overall working really great ! Maybe Art of War need more seeds but I will stick to µTorrent for the moment :p When the PDF was downloaded I delete the folder and try to [j] force recheck or anything else but nothing did it (though I don't know if this also happen with others torrent client, I rarely do that :@) No use for torrent currently but what a nice Module ! So much things to learn about Torrent protocol. Great piece of work Brucey, thanks ;) |
| ||
By the way OpenSSL libeay32.dll and libssl32.dll (I needed to rename this one ssleay32.dll for some reasons) aren't present in the module. I suggest using the installer from here : http://www.slproweb.com/products/Win32OpenSSL.html I don't think it's such a great idea to include these dlls.. otherwise that's something else I need to keep up-to-date... Maybe Art of War need more seeds Quite possibly. It's just a little example I found. Just enough to demonstrate that everything works. try to [j] force recheck Not currently implemented in the example :-) It wouldn't be so bad if I was directly porting the C++ example to BlitzMax, but since I'm using Graphics to display it, I'm having to rewrite blocks to fit better in that kind of display. I do like the fact that it runs happily in the background, and can be used with no user-interaction whatsoever. A torrent library is even more niche than my usual modules, but it's nice to have it - even if noone else really wants it :-p |
| ||
No no! Im going to use this:) |
| ||
count me in as someone with plans. Torrents are a fantastic way to handle updates for things as it eases your server load when something new comes out (see world of warcraft and a lot of other MMOs are following as well) and an integrated updater is key as no one is going to get a client and learn to use it just to update a program. Yet again, thanks Brucey! |
| ||
Yes, another fantastic module! |
| ||
Option "i" in the example is showing lots more useful information now - live peer stats - which looks kind of groovy - except there's not always enough screen to show everything... :-) But at least you won't be too short on statistics... |
| ||
The latest "client_test" example, showing multiple torrents, peers and pieces. |
| ||
It seems to work very well. :) Is there any way to create a torrent file with this library? |
| ||
Is there any way to create a torrent file with this library? Yes, apparently. But I've not covered that part of the API yet. |
| ||
Does it also support prioritizing, and rate-limiting? |
| ||
Does it also support prioritizing, and rate-limiting? You can set priority by file or by piece. You can set upload/download limits by session (global), torrent or peer (ip address). |
| ||
Any plans to make it work on Linux? Or should it already? I had trouble compiling anything with it due to boost linking errors which I couldn't figure out. |
| ||
I haven't had a chance to test the Linux build yet. So, in answer to your questions... Yes and possibly. :-) |
| ||
Apologies for the delay... It's now also working on Linux. (see SVN for latest) :-) |
| ||
Then I must be doing something wrong... The module compiles, but trying to compile client_test.bmx I get linker errors like this: |
| ||
Are you also using the latest BaH.Boost? (from SVN) <EDIT> And have you built it? |
| ||
Thanks for the module Brucey! It does almost all I wanted :) It works perfectly on windows but it doesnt start on winpe which is where I needed it. Perhaps something to do with the crypto dlls or something. So I guess i have to go back to the drawing board. |
| ||
It works perfectly on windows but it doesnt start on winpe which is where I needed it. Perhaps something to do with the crypto dlls or something. What about this? |
| ||
Are you also using the latest BaH.Boost? (from SVN) <EDIT> And have you built it? I guess something was wrong with my local version. I removed it and checked out again and now it works. Sorry about that, and thanks for the module! |
| ||
...No longer compiles under Win32 after the boost SVN update the other day: Compile Error: File 'c:/code/blitzmax/mod/bah.mod/boost.mod/src/libs/thread/src/win32/exceptions.cpp' not found [c:/code/blitzmax/mod/bah.mod/libtorrent.mod/source.bmx;117;64] Build Error: failed to compile (The exceptions.cpp file is indeed no longer there. I removed both the libtorrent and the boost folders and re-synced, and still get the same error) |
| ||
Apologies. I missed a commit. Too many modules, me thinks.... :-/ |
| ||
Looks like that did the trick... Thanks again! |