Welcome to BTSharp Community Server Sign in | Join | Help

I recently recorded a show on BTSharp on dnrTV.

Here is the link to the show!  Enjoy!  http://dnrtv.com/default.aspx?showID=61

If you'd like to check out BTSharp and the associated Intellisense, you can find the download at http://btsharp.com/Download.aspx.

You can create a free 30-day evaluation BTSharp account at https://btsharp.com/billing/shop_main.aspx.

Happy Downloading!

Creating a .torrent file with BTSharp 2.0

This will create a .torrent file that describes myfile.mp3.

private string myContentProviderId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
stringfile = @"c:\myfile.mp3";
ShareInfo shareInfo = ShareInfo.Create(file, myContentProviderId);
shareInfo.Save(@"c:\myfile.torrent");

When using an external library within your application, it's often useful to understand what's going on in the background. I hope achitectural explaination helps developers to conceptualize how to use BTSharp.

  1. The BTSharp Core Library -  This is the BTSharp assembly, OkayPublish.BTSharp.dll.  This is what you as a developer import into your .NET solution to enable BitTorrent powered file transfers.

  2. Third Party Application that uses BTSharp - This is where you come in, this is your application.  The application you're developing that leverages BTSharp for P2P file transfers.

  3. BTSharp Reporting Services - This is what allows us to keep track of usage.  Periodically, applications using BTSharp will report back to the reporting service.

  4. BTSharp User Interface Controls - The Design-time controls allow you to drag and drop user interfaces into your applications for debugging or production use.

  5. BTSharp Tracker (http://tracker2.btsharp.com/announce.aspx) - This default tracker is free for people using BTSharp.  To use it, simply state http://tracker2.btsharp.com/announce.aspx as the tracker URL in your ShareInfo.

  6. Metafile Hosting (http://share.btsharp.com/) - Store your .share files with us.  It's free, and we accomodate files up to 400 KB in size. We offer this service so that you don't need to own any servers to use BTSharp.

    There is a public SOAP-based API for you to upload your files to us.  When you invoke the "string Upload(byte[])" method, you are returned an identifier for your file.  To access your file, simply reference the link http://share.btsharp.com/q.aspx?link=YOURFILEIDENTIFIER to download the .share file you uploaded to our servers.


  7. BTSharp Seeder Servers - Our seeder servers offer reliability of file transfers in the wild. There is a more complete description of the BTSharp Seeder Servers here.

 BTSharp 2.0 Architecture

 

Developers have choices when it comes to content distribution.  HTTP, FTP, and P2P are just a few standard protocols we can use.

One of the most closely related technologies to BTSharp is Amazon S3.  BTSharp is a great alternative to Amazon S3 for developers seeking to easily integrate scalable, fast, reliable, and inexpensive file transfers into their existing or future applications.

Price comparison of BTSharp vs. Amazon S3

Amazon S3:    $ 0.20 / GB of data transferred
BTSharp:         $ 0.10 / GB of data transferred

Using BTSharp in your application can save you %50 over using Amazon S3.

You may qualify for aditional savings if you opt in for our subscription-based pricing plan or opt in for a term agreement.

Variable Pricing

We offer a variable pricing plan, as a simple and straight-forward way for companies to plan for incremental costs.

$ 0.10 / GB (Save %50 compared to Amazon S3)

Subscription-based Pricing

If you expect to use a larger amount of bandwidth in a given month, you may want to choose our subscription-based pricing plan.

$89 / month up to 1,000 GB transferred  ($0.089 / GB ) (Save %55 compared to Amazon S3)
$790 / month up to 10,000 GB transferred  ($0.079 / GB ) (Save %60 compared to Amazon S3)
$6,900 / month up to 100,000 GB transferred  ($0.069 / GB ) (Save %65 compared to Amazon S3)
$59,000 / month up to 1,000,000 GB transferred  ($0.059 / GB ) (Save %70 compared to Amazon S3)

12 and 24 month terms save you up to 30% off regular prices, and you can cancel at any time to get a refund.

If you exceed your pre-paid bandwidth usage with subscription-based pricing, the bandwidth will be billed at $0.10, $0.09, $0.08, or $0.07 depending on your respective subscription-based plan.

Terminology 

GB = Gibibyte, (2 ^ 10) ^ 3 bytes or 1,073,741,824 bytes
More information about binary termonology can be found here: http://en.wikipedia.org/wiki/Binary_prefix

It's about ease of use. It's about reliability, stability, and empowerment.
The ability to publish information, without owning any sort of hosting account is wonderful.  The ability to do that easily is priceless.

.NET developers should be able to use the BitTorrent protocol just as easily as they use the TcpClient, HttpRequest, and SmtpClient. Now they can, with BTSharp and the BTClient.

For ease of use, C# is great!  It's easy and it's fast.
For reliability, stability, and empowerment, BitTorrent is great!  It's not so easy, but it certainly is fast, and it is most definately scalable.

BitTorrent + C# = BTSharp

Build amazing applications that are scalable, and limitless with BTSharp.  (http://BTSharp.com)

The BTSharp Team doesn't want you to have to worry about how your data gets from here to there, as long as it does quickly and easily.

Method: We host a tracker, so you don't have to

If you don't want to host your own tracker, we host a tracker that you can tell your client to use.

Now, for the best part.  If you don't enter in a tracker url as an argument to BTClient.Share(), then the BTClient will use our tracker by default! Smile

Conclusion: Pass a tracker url into the Share() function if you want to use a private tracker. Otherwise, don't worry about it!  We've got ya covered.

For some applications, protocols and transfer mechanisms are just details.  If you're a developer that wants your data transfers to "just work", then the BTSharp default tracker is for you.

When you call BTClient.Share(string filename, string contentProviderId), the library uses the default tracker that we host so that you don't have to host your own tracker.

There are some hard-coded app-config values that you can use tell BTSharp to output information about Events, Errors, Information, and Debugging.

I've included the AppSettings keys that BTSharp loads when a BTClient is instantiated.

 BTSharp app.config

BTSharp.Verbosity

Description: Defines the amount and type of console output to display during the application's run.  You can include any combination of "Event", "Error", "Debug", and "Information" in the value position of this configuration.

Event - Events include significant events including connecting to peers and disconnecting from peers

Error - When an internal error in the library is gracefully handled, output describing this occurence is logged in the console.

Debug - Detailed information about any protocol-specific occurences are outputted to the console. This is useful if there is a problem with communicating with another type of BitTorrent client and you'd like a trace of the Peer-to-Peer session between the clients.

Information - Display miscellaneous important information such as the internal values of messages received from peers.

What it's good for:  This is one of the most important tools you can use for debugging.  If you ever have a problem, you can always report a trace to david _at _ btsharp.com and we will work to resolve any hold-up you're having. 

 When you have debugging verbosity set, and you're running from a console application, the output you'll get will look like:

BTSharp Debugging Output

 

BTSharp.IsUPnPEnabled

Description: If you're behind a router, should BTSharp use the Universal Plug and Play protocol to try to open a port on the router so that you can accept incoming connections?

What it's good for: This is useful for enabling connectivity between peers transferring a file.  For end-users, UPnP makes life a lot easier than referring users to a link like http://www.no-ip.com/support/guides/routers/linksys.html.

 

BTSharp.ListeningPort

Description: By default, BTSharp starts trying to find ports to listen on starting at port 6881.  You can override the port you start trying to listen on by using this configuration in your App.config file of your project.

What it's good for: This is useful if you know that your network has a firewall and only allows incoming connections over a certain port, e.g. (port 5050).

 

BTSharp.NetworkConfig.MaxNumberOfPendingConnections

Description: This will stop your BTSharp client from trying to connect to 100 peers at once, and slowing down your performance.

What it's good for: You can control how quickly your BTClient will connect to new peers by setting this value.

 

BTSharp.NetworkConfig.MaxNumberOfActiveConnections

Description: This is used to limit the number of peers you connect to per file you are downloading.

What it's good for: Connecting to too many peers may impact performance. 

 

BTSharp.IPAddressToBindTo

Description:  If you set this, your BTClient will only listen on the specified IP Address.

What it's good for:  If you have multiple network interfaces, you can manually configure your BTClient to listen on only a certain IP Address.  This is useful if you're only transferring a file over a local area network, behind a NAT.  If you are configured behind a Virtual (Private) Network, this would be useful as well.