There is my daemon that sends and receives data via TCP and UDP. Logical connection is often a group of such streams.
I'm going to make a web page to report the types of these connections and how much data has been transfered. Can't do that by just calling netstat, because it's hard to figure out which connection is which, especially with UDP that can change ports. So, the daemon should accumulate the statistics.
I don't want to put the web server inside the daemon. Don't want to write statistics constantly into a file.
The good idea is used in /proc kernel filesystem, where the reads on files from that filesystem invoke functions in the application. It works on-demand. Would be nice to have something like that.
Are there any examples of some existing UNIX/Linux daemons that have such requirements? What do they do?