Skip to content
Snippets Groups Projects
Commit 523311da authored by Adrien Béraud's avatar Adrien Béraud
Browse files

Update README.md

parent 116bc05c
No related branches found
Tags android/release_354
No related merge requests found
...@@ -25,18 +25,18 @@ TODO ...@@ -25,18 +25,18 @@ TODO
Examples Examples
- -
```c++ ```c++
dht::DhtRunner dht; dht::DhtRunner node;
// Launch a new dht node using generated RSA keys, // Launch a new dht node using generated RSA keys,
// and listen on port 4222. // and listen on port 4222.
dht.run(4222, dht::crypto::generateIdentity()); node.run(4222, dht::crypto::generateIdentity());
// put some data on the dht // put some data on the dht
std::vector<uint8_t> some_data(5, 10); std::vector<uint8_t> some_data(5, 10);
dht.put("unique_key", some_data); node.put("unique_key", some_data);
// get data from the dht // get data from the dht
dht.get("other_unique_key", [](const std::vector<std::shared_ptr<Value>>& values) { node.get("other_unique_key", [](const std::vector<std::shared_ptr<Value>>& values) {
// Callback called when values are found // Callback called when values are found
for (const auto& value : values) for (const auto& value : values)
std::cout << "Found value: " << value << std::endl; std::cout << "Found value: " << value << std::endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment