X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=meshlink-sample%2Fmeshlinkapp.c;h=647e6b77630c66b05b2d14e664ae3d1a4899ebbf;hb=7139dc96be39abcdcf7f20e134a5e9b8abce05c4;hp=3be653526d269634e0962130a4492888753f1047;hpb=7ef762c6ac85e3eb7c21c41cd752ba130279f232;p=meshlink diff --git a/meshlink-sample/meshlinkapp.c b/meshlink-sample/meshlinkapp.c index 3be65352..647e6b77 100644 --- a/meshlink-sample/meshlinkapp.c +++ b/meshlink-sample/meshlinkapp.c @@ -5,9 +5,28 @@ int main(int argc , char **argv){ char *confbase = "/tmp/meshlink/"; char *name = "test"; +node_t* remotenode = new_node(); +char *remotename = "nameofremotenode"; + +//TODO: change this, calling a function that returns node_t +remotenode->name = malloc(16); +remotenode->name = remotename; + tinc_setup(confbase, name); tinc_start(confbase); +sleep(2); //there is a race condition here, tinc_start detaches to a thread the needs time to setup stuff +while(1) { + +//sample data to send out +char mydata[200]; +memset(mydata,0,200); +strcpy(mydata,"Hello World!"); + +//send out data +tinc_send_packet(remotenode,mydata,sizeof(mydata)); sleep(10); //give time to this thread to finish before we exit +} +free(remotenode); return 0; }