* 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
This commit is contained in:
drbob 2010-10-31 18:24:12 +00:00
parent 33282bfc77
commit cbdd08cd34
7 changed files with 1401 additions and 515 deletions

View file

@ -0,0 +1,42 @@
#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;
}