From 6fdbf840b7e2895e6b15fabd6e2734d09c579eca Mon Sep 17 00:00:00 2001 From: tth Date: Wed, 4 Nov 2020 09:46:21 +0100 Subject: [PATCH] udp-dumper: better display --- tools/Makefile | 3 ++- tools/udp-dumper.c | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/Makefile b/tools/Makefile index 8498370..9437a63 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,8 +1,9 @@ # -# Various OSC tools +# Various OSC (and UDP) tools # # https://git.tetalab.org/tTh/gadgets-OSC udp-dumper: udp-dumper.c Makefile gcc -Wall $< -o $@ + diff --git a/tools/udp-dumper.c b/tools/udp-dumper.c index 3f41ec5..cf76a76 100644 --- a/tools/udp-dumper.c +++ b/tools/udp-dumper.c @@ -45,6 +45,8 @@ long serial; double starttime, curtime; struct timeval tp; +fprintf(stderr, "%s: listen on port %d\n", __func__, port); + if (-1==(sock=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))) { perror("socket fail "); exit(1); @@ -77,11 +79,12 @@ do { if (verbosity) { gettimeofday(&tp, NULL); curtime = tp.tv_sec + tp.tv_usec / 1e6; - printf("----+ %5d b ts: %.3f\n", foo, curtime - starttime); + printf("----+ %4ld %5d b ts: %.3f\n", + serial, foo, curtime - starttime); } for (bar=0; bar<=foo; bar+=16) { - printf("%3ld | ", serial); + printf("%3ld | ", bar); dumpln(buffer+bar); } serial++;