Test new interfaces.
This commit is contained in:
parent
d513080baa
commit
72fae99e89
22
demo/main.c
22
demo/main.c
@ -18,14 +18,7 @@
|
||||
|
||||
#include <neocomm.h>
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
|
||||
int run = 1;
|
||||
|
||||
void quit(int sig) {
|
||||
puts("\nInterrupt signal received.");
|
||||
run = 0;
|
||||
}
|
||||
#include <string.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if(argc != 2 && argc != 4)
|
||||
@ -49,11 +42,20 @@ int main(int argc, char *argv[]) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
signal(SIGINT, quit);
|
||||
if(connect_address)
|
||||
NeoComm_connect(connect_address, connect_port);
|
||||
|
||||
while(run) { }
|
||||
while(1) {
|
||||
char in[128];
|
||||
printf("> ");
|
||||
scanf("%s", in);
|
||||
if(strcmp(in, "/exit") == 0 || strcmp(in, "/quit") == 0)
|
||||
break;
|
||||
else if(strcmp(in, "/stats") == 0)
|
||||
printf("%s", NeoComm_get_node_stats());
|
||||
else if(strcmp(in, "/num_nodes") == 0)
|
||||
printf("%u", NeoComm_count_connected_nodes());
|
||||
}
|
||||
|
||||
NeoComm_deinit();
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user