Opensource C# BitTorrent library  
Author Message
--Alan---





PostPosted: Show and Tell, Opensource C# BitTorrent library Top

Hi there everyone,

I've written an open source bittorrent client library which runs on Windows/MacOS and nearly all flavours of Linux which is pretty much at Beta 2 status, i.e. most of the really big bugs are gone. The source is available at the public SVN for mono under the Bitsharp folder (details can be found at www.mono-project.com).

There is also a TorrentCreator and BitTorrent Tracker library available at the same place, both written in C# aswell. Those are also needing developers should anyone be interested in pitching in.

Example code and a more detailed blurb is at www.mono-project.com/Bitsharp.

Basically, i'm doing a call to developers to:
1) Try and find a few people who wish to help with further developing the library.
2) Try and find a person or two who want to make either a standard GUI, a web-based interface or console-based interface for the library (or all 3 if they want ;) )
3) Make people more aware of MonoTorrent's existance.


Community Chat7  
 
 
V.Tortola





PostPosted: Show and Tell, Opensource C# BitTorrent library Top

Isn't posible open the solution with VS2005 is only for SharpDevelop/MonoDevelop

Very interesting project.

Thanks.

Regards.



 
 
--Alan---





PostPosted: Show and Tell, Opensource C# BitTorrent library Top

Well, the problem is that i develop against Mono and so in SD i have the TargetFramework set to use Mono. If you try and load the project in VS it can't understand the TargetFrameword attribute in the csproj file and breaks.

As a temporary workaround you can open each csproj file in notepad and do the following:

Remove the following attribute from each of the .csproj files:
<TargetFrameworkVersion>Mono v2.0</TargetFrameworkVersion>

and change this line (found at the very end of the .csproj file):
<Import Project="$(SharpDevelopBinPath)\SharpDevelop.Build.CSharp.targets" />
to this line:
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />

You should then be able to open the file in VS without a problem. It'll compile perfectly against the MS.NET and Mono framework (though due to bugs/undocumented "features" in the MS.NET framework there are a few really bad bugs in the app with async sockets).

Feel free to give me an email if you have any questions or want to submit a few patches/implement some new features. My email address is plastered all over the .cs files :p

 
 
V.Tortola





PostPosted: Show and Tell, Opensource C# BitTorrent library Top

Thanks, i will probe again tomorrow :)


 
 
--Alan---





PostPosted: Show and Tell, Opensource C# BitTorrent library Top

Just a quick FYI: If you're getting the source from the SVN, that is currently broken :P I'm not quite sure when the change happened that broke it so i can't recommend an exact version to step back to. The only "working" version would be this:

http://rapidshare.de/files/37335494/MonoTorrent.zip

which is compiled here:

http://rapidshare.de/files/37340101/MonoTorrent_Compiled.zip

But that source may also deadlock randomly. I believe the problem occured when i changed my rate limiting method, so i think i know how to resolve it. So the svn version should be fixed in a day or two. Just check the commit logs for when i mention the "threading deadlock" is fixed.

 
 
V.Tortola





PostPosted: Show and Tell, Opensource C# BitTorrent library Top

One thing , what's nunit.framework don't exist in the zip file, and i can't compile :P

Other thing, if i run the TestClient.exe (in the compiled.zip) crash.


Unhandled exception
Unhandled
Name:TestClient.exe
There are no context policies.


The debuger says :  Invalid torrent file specified.

I'm using this torrent.

Regards.


 
 
--Alan---





PostPosted: Show and Tell, Opensource C# BitTorrent library Top

The reason that happens is because the torrent file you supplied is actually an invalid .torrent file ;) Azurues will load it, uTorrent does (iirc) but neither of them should. If you load the .torrent into the mainline (official) bittorrent client, that client won't load the torrent.

The problem is that the keys in the dictionary have to be sorted alphabetically, if they aren't sorted alphabetically, the .torrent is illegal. The keys in your .torrent aren't sorted alphabetically. Therefore illegal. I could load the torrent anyway, but then there's no guarantee that the correct infohash will be generated which means theres no guarantee that you'll be able to download the torrent.

As for NUnit.Framework, best place to get it is here: http://www.nunit.org/index.php p=download But i will bundle it into the SVN when i get a chance.

Thanks,
Alan.

 
 
--Alan---





PostPosted: Show and Tell, Opensource C# BitTorrent library Top

Hi,

Just a quick update. There was actually a bug in the BEncoding class. The string comparison used to see if keys are alphabetically ordered should be a binary comparison, i was previously using a "natural" comparison.

That torrent will load now.

Thanks,
Alan.

 
 
mp4city





PostPosted: Show and Tell, Opensource C# BitTorrent library Top

what about a DHT SERVER for trackless torrents make it simple
 
 
--Alan---





PostPosted: Show and Tell, Opensource C# BitTorrent library Top

Unfortunately "DHT" and "simple" don't fit in the same sentence. Implementing DHT is a lot of work and is a low priority feature at the moment. I'm much more interested in getting everything working 100% first and making sure i have memory and cpu usage pinned as low as i can get it.

But if you're up for it, you can start on a DHT module yourself. You don't need to know anything about bittorrent to write it! I'd love it if someone wrote a DHT module that i could then cut and paste into MonoTorrent. You can check out the spec for DHT on wiki.theory.org i believe. (look for the bittorretn specification page).

DHT is something that is on the books, but that's definitely a V1.5 feature.

 
 
mp4city





PostPosted: Show and Tell, Opensource C# BitTorrent library Top

you might want to look into this after you finished cpu work

found interesting framework for distributed storage

A Distributed Hash Table (DHT) for python,
such as SharkyPy and khashmir, maybe it would be easy for experienced programmer to port that into c#

SharkyPy_ docs dht

http://www.heim-d.uni-sb.de/~heikowu/SharkyPy/doc/

khashmir_ docs dht

http://khashmir.sourceforge.net/

i wish i could code it, but i'm not experienced, I'm pretty new to programming


 
 
--Alan---





PostPosted: Show and Tell, Opensource C# BitTorrent library Top

The best docs would be http://www.bittorrent.org/Draft_DHT_protocol.html. Using a python based version to implement my own DHT wouldn't really be that useful to me since i don't know python. What i could do is compile the python to .NET code (see IronPython) and use it directly, which would require no extra work and no extra coding on my side, but there's no guarantees the resulting code would be efficient. It'd work, but more than likely not as well as a custom written thing.

So what if you're new to programming, you can still give it a shot yourself. You'll learn stuff even if you never end up finishing your attempt!