All Projects → ss16118 → torrent-client-cpp

ss16118 / torrent-client-cpp

Licence: MIT License
A simple BitTorrent client written in C++

Programming Languages

C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to torrent-client-cpp

torrent-hound
Search torrents from multiple websites via the CLI
Stars: ✭ 28 (+16.67%)
Mutual labels:  bittorrent
dottorrent-cli
Command-line tool for creating .torrent files, powered by dottorrent
Stars: ✭ 20 (-16.67%)
Mutual labels:  bittorrent
IPS-BitTracker
Bit Torrent Tracker application for IPS 4.5x Community Suite
Stars: ✭ 18 (-25%)
Mutual labels:  bittorrent
autobrr
Automation for downloads.
Stars: ✭ 288 (+1100%)
Mutual labels:  bittorrent
uWebTorrentTracker
🔆 Simple, robust, WebTorrent tracker server implementation
Stars: ✭ 58 (+141.67%)
Mutual labels:  bittorrent
bencoder.pyx
A fast bencode implementation in Cython
Stars: ✭ 26 (+8.33%)
Mutual labels:  bittorrent
PeerflixServerZH
🚀 Peerflix Server(BT) 汉化、美化
Stars: ✭ 32 (+33.33%)
Mutual labels:  bittorrent
privtracker
Private BitTorrent tracker generator
Stars: ✭ 84 (+250%)
Mutual labels:  bittorrent
CheckWebPeer
Check WebRTC peers of torrents.
Stars: ✭ 19 (-20.83%)
Mutual labels:  bittorrent
ocelot
Alternative compiled announcer (ocelot)
Stars: ✭ 14 (-41.67%)
Mutual labels:  bittorrent
ut pex
Implementation of ut_pex bittorrent protocol (PEX) for webtorrent
Stars: ✭ 54 (+125%)
Mutual labels:  bittorrent
go-libutp
Go wrapper of libutp reference uTP C implementation
Stars: ✭ 75 (+212.5%)
Mutual labels:  bittorrent
swarm-peer-server
🖧 A network swarm for creating secure P2P connections over BitTorrent DHT, DNS, and mDNS.
Stars: ✭ 41 (+70.83%)
Mutual labels:  bittorrent
rarbg-api
A simple node.js wrapper for rarbg.to api
Stars: ✭ 21 (-12.5%)
Mutual labels:  bittorrent
CuteTorrent
BitTorrent client based on libtorrent-rasterbar with user-friendly interface
Stars: ✭ 27 (+12.5%)
Mutual labels:  bittorrent
MlDHT
MLDHT is an elixir package that provides a mainline DHT implementation according to BEP 05.
Stars: ✭ 88 (+266.67%)
Mutual labels:  bittorrent
I2P-in-Private-Browsing-Mode-Firefox
I2P in Private Browsing mode for Firefox, built using Webextensions and Contextual Identities
Stars: ✭ 31 (+29.17%)
Mutual labels:  bittorrent
nexusphp
A private tracker application base on NexusPHP
Stars: ✭ 209 (+770.83%)
Mutual labels:  bittorrent
torrentcore
BitTorrent for .NET Core
Stars: ✭ 86 (+258.33%)
Mutual labels:  bittorrent
torrent-spider
基于DHT的p2p网络资源爬虫
Stars: ✭ 65 (+170.83%)
Mutual labels:  bittorrent

Torrent Client C++

This is a simple BitTorrent client written in C++. The code and the general structure of the program are primarily based on the following blog posts:

I have found both posts in this repository, which contains numerous tutorials. It is definitely worth looking into for anyone who wants to implement their own tools from ground up.

Note that this is my very first C++ project, which I mainly started to familiarize myself with the language. Hence, the code might not comply with the normal C++ styles, and there are undoubtedly places where the code can be optimized.

Quick start

If you want to try this BitTorrent client yourself, follow the steps below:

  • Clone this repository, and make sure that cmake (> 3.19.2) is installed.
  • Type the following commands into the terminal (note that fetching the cpr library will take some time, so the compilation process might be time-consuming.):
$ cd torrent-client-cpp && mkdir build && cd build
$ cmake .. && make -j
  • To download the ubuntu iso as an example, enter the following command:
$ ./BitTorrentClient -t ../res/ubuntu-12.04.5-alternate-amd64.iso.torrent -o ../res/  # logging disabled
$ ./BitTorrentClient -t ../res/ubuntu-12.04.5-alternate-amd64.iso.torrent -o ../res/  -l # logging enabled, log can be found in logs/client.log
  • The output will be similar to this:
Parsing Torrent file ../res/ubuntu-12.04.5-alternate-amd64.iso.torrent...
Download initiated...
[Peers: 4/5, 0.52 MB/s, ETA: 25:18][>                                       ] 4/1522 [0.26%] in 00:13
  • All files in the res directory can be used for testing. The files MoralPsychHandbooks.torrent and ComputerNetworks.torrent all come from Academic Torrents. They are small Torrent files which are suitable for testing all the basic functionalities of the BitTorrent client. Whereas the Torrent files for ubuntu and debian are great for stress tests.

Commandline Options

The program supports the following commandline options:

Options Alternative Description Default
-t --torrent-file Path to the Torrent file REQUIRED
-o --output-dir The output directory to which the file will be downloaded REQUIRED
-n --thread-num Number of downloading threads to use. (i.e maximum number of peers that the client can connect to) 5
-l --logging Enable logging false
-f --log-file Path to the log file ../logs/client.log
-h --help Print arguments and their descriptions

Supported Features

The current implementation of this BitTorrent client only supports the following features:

  • Retrieving a list of peers from the tracker periodically.
  • Downloading single-file Torrents in a multi-threaded manner.

To make it an actual usable BitTorrent client, it will have to include:

  • Seeding
  • Resuming a download.
  • Downloading multi-file Torrents
  • Probably a more intuitive user interface.
  • Pipelining when requesting blocks from peers.
  • Connecting to as many peers as possible.

Since this is only a project that I started for fun and to learn C++, it is unlikely that any of the unsupported features will be implemented any time soon. If you wish to build on top of my current code, feel free to do so.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].