There are actually two implementations of netcat, the original implementation by *Hobbit* (called netcat-traditional
in Debian/Ubuntu) and the OpenBSD implementation (called netcat-openbsd
in Debian/Ubuntu). In Debian/Ubuntu the binaries are called nc.traditional
and nc.openbsd
respectively (and nc
is a link to one of those via the alternatives system).
The blog post you reference is using nc.traditional
which does show the sent/received bytes when exiting. You are probably using nc.openbsd
which doesn't. Install the traditional implementation and call it explicitly.
% time yes | nc.traditional -vvn 127.0.0.1 10000 > /dev/null
(UNKNOWN) [127.0.0.1] 10000 (webmin) open
^C sent 99422208, rcvd 0
yes 1,06s user 0,09s system 38% cpu 3,003 total
Alternately, if you prefer to use the nc.openbsd
you can pipe the output of netcat on the server side to wc -c
and inspect the output like so:
% nc -l -n -p 10000 | wc --bytes
99422208