Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ implementation of DHT

I am looking for opensource implementations of Kademlia DHT in C/C++. It must be lightweight and crossplatform (win/linux/mac).

It must be able to post information to DHT and retrieve it.

like image 412
Alexander Shishenko Avatar asked Jun 08 '11 15:06

Alexander Shishenko


4 Answers

OpenDHT is a lightweight Kademlia DHT in C++11. The API is very simple :

dht::DhtRunner node;

// Launch a dht node on a new thread, using a
// generated RSA key pair, and listen on port 4222.
node.run(4222, dht::crypto::generateIdentity(), true);

// Join the network through any running node,
// here using a known bootstrap node.
node.bootstrap("bootstrap.jami.net", "4222");

// put some data on the dht
std::vector<uint8_t> some_data(5, 10);
node.put("unique_key", some_data);

It supports compiling with LLVM or GCC on OS X, Linux and Windows.

like image 98
aberaud Avatar answered Oct 25 '22 01:10

aberaud


LibTorrent's Kademlia DHT is written in C++ and is well documented.
Here is example code with immutable and mutable get/put operations: https://github.com/arvidn/libtorrent/blob/master/tools/dht_put.cpp

like image 43
Tails From The Crypt Avatar answered Oct 25 '22 02:10

Tails From The Crypt


What's wrong with maidsafe-dht ?

like image 20
Kirill V. Lyadvinsky Avatar answered Oct 25 '22 02:10

Kirill V. Lyadvinsky


You could try bitdht used by retroshare.

like image 21
fredix Avatar answered Oct 25 '22 02:10

fredix