monotorrent icon indicating copy to clipboard operation
monotorrent copied to clipboard

Scattered Samples

Open InteXX opened this issue 4 years ago • 10 comments

The code samples are scattered about in a confusing fashion.

I'd like to suggest consolidating them under a single folder.

InteXX avatar Dec 07 '21 16:12 InteXX

Yup - that makes sense! I'll do a little reorganise later today.

Is there anything in particular you'd like to see a sample of which isn't in the sample client?

alanmcgovern avatar Dec 08 '21 20:12 alanmcgovern

I moved everything under 'samples' so it's a bit clearer now! I deleted irrelevant ones and fixed up ones I wanted to keep :) Let me know if you have any other suggestions!

alanmcgovern avatar Dec 09 '21 20:12 alanmcgovern

Pardon my delay, I've got a lot going on at the moment. Thank you for the reorg—that was a quick response.

Is there anything in particular you'd like to see a sample of

That's not an easy answer, at least from my perspective. I know next to nothing about BitTorrent, let alone how to use it.

But I do understand the basic underlying concept (P2P).

I'd like to investigate the possibility of using it to deploy updates for the software that I write, with the aim of reducing or even eliminating storage fees.

With that goal in mind, MonoTorrent seems like it might be a good place to start looking. Samples toward this end would be very helpful.

Are some already present that I should dig into?

InteXX avatar Dec 10 '21 03:12 InteXX

I'd like to investigate the possibility of using it to deploy updates for the software that I write, with the aim of reducing or even eliminating storage fees.

Yup, that is one pretty reasonable usecase. As long as you control at least one client and leave it running/seeding 24x7 then BitTorrent is a viable option.

I suspect setting up a basic tracker ( or just rely in dht) and using magnet links would be the easiest approach.

On your "seeder" machine you can use a standard torrent application, or monotorrent, to share the data. You can share a torrent magnet link with the clients using whatever mechanism you want, which those clients can use to download the .torrent metadata as well as the data itself.

This way you just need to distribute a simple URL to your clients which need updates and everything else will Just Work (give or take).

Let me know if you have any questions!

The Client sample shows how to download torrents. The streaming example loads magnet links too.

alanmcgovern avatar Dec 22 '21 20:12 alanmcgovern

I'll leave this open until you're happy you have the information you need!

alanmcgovern avatar Dec 22 '21 20:12 alanmcgovern

I'll leave this open until you're happy you have the information you need

Omigosh. Thank you... but that'll take months! This is very much a for-the-distant-future investigation.

But tell me—is there a way to meter the client bandwidth? I'd like to reward customers who opt in to participating in the hosting.

InteXX avatar Dec 22 '21 21:12 InteXX

You could set a max upload/download speed using EngineSettings or TorrentSettings. This would artificially slow down uploads/downloads, bit would be unlikely to improve the experience for people in general.

If you want to do more than just that then it's hard to know what to recommend without knowing the full details of what you'd want. I'd say it's a little outside my scope, though I'd be curious anyway! :)

alanmcgovern avatar Dec 30 '21 17:12 alanmcgovern

Well, not so much throttle as meter. Keep track of it.

I'd like to reward each customer according to his individual bandwidth contribution.

InteXX avatar Dec 30 '21 18:12 InteXX

Torrent clients (including monotorrent) regularly report upload/download amounts to the tracker. If you host a tracker, you can monitor and track this data over time.

It's also possible to uniquely identify individuals by sending each of your users a modified version of the torrent metadata. The modification is to add a unique identifier to the announce url, like ?user=some_unique_token. Torrent clients will include that part of the query string when announcing to the tracker, providing a deterministic way to track your users stats over time.

Would that work? It's a technique used by most private trackers which track upload/download ratios.

alanmcgovern avatar Dec 30 '21 19:12 alanmcgovern

That sounds absolutely perfect, Alan.

Good job on this!

InteXX avatar Dec 30 '21 19:12 InteXX