News for hackers. Stuff that matters.

cheatdeath

Re:Building a BitTorrent client from scratch in C# on Wednesday July 06, 2016 @02:52AM (#12041582)
Thanks for the comments! I'm all for improved readability. I definitely wasn't aiming for much performance wise, at least initially. These were two areas (of many) that I felt could do with some improvement (especially the file IO). I will look into making some modifications like those suggested when I get a chance.
Re:China’s tyranny of characters on Wednesday July 06, 2016 @02:43AM (#12041552)
I guess I've just been assuming any Roman characters are English, some definitely might be Pinyin. I generally try not to stare at peoples screens for too long haha. I did an intro to Chinese (Mandarin) class a few years ago so I'm aware of Pinyin but have forgotten almost everything (except some of the bits I found particularly interesting like word order for times and places, how numbers are represented and a few other things).
Re:Building a BitTorrent client from scratch in C# on Wednesday July 06, 2016 @02:29AM (#12041526)
Thanks for the tips! I will look into making these modifications when I get a chance.
Re:Building a BitTorrent client from scratch in C# on Wednesday July 06, 2016 @12:40AM (#12041248)
Thanks for the pointer!
Re:China’s tyranny of characters on Wednesday July 06, 2016 @12:36AM (#12041233)
In Hong Kong, I sometimes see peoples screens when I'm using public transport. WhatsApp audio recordings are very popular, sometimes I can see the entire conversation is just audio recordings back and forth. Other times it's Chinese (I can't differentiate which), sometimes English, often a mix. I've only seen someone drawing characters with his finger once.
Re:Building a BitTorrent client from scratch in C# on Tuesday July 05, 2016 @07:42PM (#12040284)
Honestly I'm just not that familiar with async/await. I'll look into modifying it when I get around to making some other changes.
Re:Building a BitTorrent client from scratch in C# on Tuesday July 05, 2016 @07:36PM (#12040265)
Thanks for letting me know, looks like I'll have to find some time to implement some of these recommendations.
Re:Building a BitTorrent client from scratch in C# on Tuesday July 05, 2016 @07:31PM (#12040246)
Oh cool, thanks! I wasn't aware of DateTimeOffset.
Re:Building a BitTorrent client from scratch in C# on Tuesday July 05, 2016 @10:04AM (#12036476)
World of Warcraft? Haha no, I've been using that handle probably since that game came out but I've never played it.
Re:Building a BitTorrent client from scratch in C# on Tuesday July 05, 2016 @08:55AM (#12036041)
Sorry, I didn't update some of the links in the contents correctly when creating the mirror. They should be fixed now – everything is on one page.
Re:Building a BitTorrent client from scratch in C# on Tuesday July 05, 2016 @08:36AM (#12035932)
Thanks.

Actually organising the write up forced me to tidy up the code much more than I otherwise would have. I definitely find C# to be one of the more readable languages although I have had to debug and untangle some C# messes before.

Yeah I remember changing it to a SortedDictionary but I changed it back. I can't remember exactly why, possibly because it's supposed to be sorted by raw UTF8 bytes rather than a nice neat C# string and I didn't want to start using byte arrays for dictionary keys. I guess it only needs to be sorted when in the BEncoding format and it felt better to keep the internal structure as simple as possible. The tradeoff is it doesn't support incorrectly encoded torrent files – I'm really not sure how much of an issue that is.

Re:Building a BitTorrent client from scratch in C# on Tuesday July 05, 2016 @08:16AM (#12035854)
I'm not that familiar with .NET Core. It doesn't look like MiscUtil is compatible with it.

The executable project has some minor references to Mono.Posix just so it can catch kill signals while running in the Terminal and die gracefully.

Both dependencies can be removed quite easily from the project.

Re:Building a BitTorrent client from scratch in C# on Tuesday July 05, 2016 @08:00AM (#12035780)
Will do, thanks for posting.
Re:Building a BitTorrent client from scratch in C# on Tuesday July 05, 2016 @07:51AM (#12035744)
If anyone's having issues, I've mirrored it at https://cheatdeath.github.io/research-bittorrent-doc/

edit: I'm the author, let me know if you have any questions.

Re:Building a BitTorrent client from scratch in C# on Tuesday July 05, 2016 @07:29AM (#12035657)
It's not completely down, the server does seems to be struggling though.
Re:How to Write a BitTorrent Client, Part 1 on Tuesday July 05, 2016 @06:25AM (#12035475)
I recently went through the same thing – building my own simple BitTorrent client, mostly just due to curiosity about how the protocol works. There were some tricky parts, most of which are outlined in this but I found the underlying concept so simple. I guess simplicity is a requirement for scale and resilience.

I wrote up my adventure too: http://seanjoflynn.com/research/bittorrent.html

Presumably in case someone is watching you type in your details.

Older »