RetroShare/libbitdht/src/example/bdexample.cc
drbob cbdd08cd34 * Improved udpbitdht tests.
* 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
2010-10-31 18:24:12 +00:00

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;
}