summaryrefslogtreecommitdiffstats
path: root/src/TestStatsServer.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-01-17 15:25:23 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-01-17 15:25:23 +0100
commitedb874717f758475d8fa1b433b71b601d1774e84 (patch)
treec5bd1098e51bdae39d0bad972f64c5ff066ec379 /src/TestStatsServer.cpp
parent0ec9156736c97ac2e6c5b20035634e17ea350c5e (diff)
downloaddabmux-edb874717f758475d8fa1b433b71b601d1774e84.tar.gz
dabmux-edb874717f758475d8fa1b433b71b601d1774e84.tar.bz2
dabmux-edb874717f758475d8fa1b433b71b601d1774e84.zip
add code for TCP statistics server
Diffstat (limited to 'src/TestStatsServer.cpp')
-rw-r--r--src/TestStatsServer.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/TestStatsServer.cpp b/src/TestStatsServer.cpp
new file mode 100644
index 0000000..7ec0342
--- /dev/null
+++ b/src/TestStatsServer.cpp
@@ -0,0 +1,26 @@
+#include <stdio.h>
+#include "StatsServer.h"
+
+#define NUMOF(x) (sizeof(x) / sizeof(*x))
+
+int main(int argc, char **argv)
+{
+ int stats_example[] = {25, 24, 22, 21, 56, 56, 54, 53, 51, 45, 42, 39, 34, 30, 24, 15, 8, 4, 1, 0};
+ StatsServer serv(2720);
+
+ serv.registerInput("foo");
+ while (true) {
+ for (int i = 0; i < NUMOF(stats_example); i++) {
+ usleep(400000);
+ serv.notifyBuffer("foo", stats_example[i]);
+ fprintf(stderr, "give %d\n", stats_example[i]);
+
+ if (stats_example[i] == 0) {
+ serv.notifyUnderrun("foo");
+ }
+ }
+ }
+
+ return 0;
+}
+