I'm not sure how it works beyond that it reads /proc, but whatever it does it uses a whole lot more compute than nethogs does (which also displays per process and also uses /proc as the information source). This is fine for most of my machines, but for lower-specced machines I'll probably have to stick with nethogs[1]
In the same area, a bit more stripped down tool that's nice is nethogs (https://github.com/raboof/nethogs). It aggregates sent/received by program which is very useful.
I've been using `nethogs` for this for a long time, and it is already in most Linux repos and can be installed quickly.
These are thrid-party programs that are unlikely to be installed on a Linux system by default:
https://github.com/raboof/nethogs
https://github.com/tmux/tmux/wiki
http://mama.indstate.edu/users/ice/tree/
http://invisible-island.net/dialog/dialog.html
Also, you should prefer "pgrep" to "pidof"; the former is available also on BSDs.