mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-25 05:19:22 -05:00
* Added Simple example - so others can understand how to interface with bitdht. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3724 b45a01b8-16f6-495d-af2f-9b41ad6348cc
42 lines
572 B
C++
42 lines
572 B
C++
|
|
|
|
#include "bitdht/bdiface.h"
|
|
#include "bitdht/bdstddht.h"
|
|
#include "bdhandler.h"
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
|
|
/* startup dht : with a random id! */
|
|
bdNodeId ownId;
|
|
bdStdRandomNodeId(&ownId);
|
|
|
|
uint16_t port = 6775;
|
|
std::string appId = "exId";
|
|
std::string bootstrapfile = "bdboot.txt";
|
|
|
|
BitDhtHandler dht(&ownId, port, appId, bootstrapfile);
|
|
|
|
/* run your program */
|
|
while(1)
|
|
{
|
|
bdNodeId searchId;
|
|
bdStdRandomNodeId(&searchId);
|
|
|
|
dht.FindNode(&searchId);
|
|
|
|
sleep(180);
|
|
|
|
dht.DropNode(&searchId);
|
|
}
|
|
|
|
return 1;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|