From: Saverio Proto Date: Sat, 9 Aug 2014 10:06:53 +0000 (+0200) Subject: example manynodes: send test messages only to other nodes and not to ourselfs X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=20bac67a09728d66dbf27cecf57fa3a3a9e170a2;p=meshlink example manynodes: send test messages only to other nodes and not to ourselfs --- diff --git a/examples/manynodes.c b/examples/manynodes.c index 98bd9387..e00b80be 100644 --- a/examples/manynodes.c +++ b/examples/manynodes.c @@ -36,11 +36,13 @@ static void testmesh () { } else { printf("%zu known nodes:\n", nnodes); for(int i = 0; i < nnodes; i++) { - printf(" %s\n", nodes[i]->name); - if(!meshlink_send(mesh[nindex], nodes[i], "magic", strlen("magic") + 1)) { + //printf(" %s\n", nodes[i]->name); + if (nindex != i) { + if(!meshlink_send(mesh[nindex], nodes[i], "magic", strlen("magic") + 1)) { fprintf(stderr, "Could not send message to '%s': %s\n", nodes[i]->name, meshlink_strerror(meshlink_errno)); - } - } + } + } + } }