udp-dumper: better display

This commit is contained in:
tth 2020-11-04 09:46:21 +01:00
parent c1327cf318
commit 6fdbf840b7
2 changed files with 7 additions and 3 deletions

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

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