Browse Source

udp-dumper: better display

master
tth 12 months ago
parent
commit
6fdbf840b7
2 changed files with 7 additions and 3 deletions
  1. +2
    -1
      tools/Makefile
  2. +5
    -2
      tools/udp-dumper.c

+ 2
- 1
tools/Makefile View File

@ -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 $@

+ 5
- 2
tools/udp-dumper.c View File

@ -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++;


Loading…
Cancel
Save