From e271de392bf0e11c9903f3918dcc3d6b7e53b99f Mon Sep 17 00:00:00 2001 From: Saverio Proto Date: Thu, 10 Apr 2014 09:26:27 +0200 Subject: [PATCH] Improved sample application --- meshlink-sample/meshlinkapp.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/meshlink-sample/meshlinkapp.c b/meshlink-sample/meshlinkapp.c index 7dd7f501..515a2d52 100644 --- a/meshlink-sample/meshlinkapp.c +++ b/meshlink-sample/meshlinkapp.c @@ -5,12 +5,27 @@ int main(int argc , char **argv){ char *confbase = "/tmp/meshlink/"; char *name = "test"; +tincremotehost* remotenode = malloc(sizeof(tincremotehost)); +char *remotename = "nameofremotenode"; + +//TODO: change this, calling a function that returns tincremotehost +remotenode->name = remotename; +remotenode->publickey = NULL; + tinc_setup(confbase, name); tinc_start(confbase); 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 -tinc_send_packet(NULL,"datafgsdfsd",10); } +free(remotenode); return 0; } -- 2.39.2