user@devops:~$ cat README.md
sockstat-watch
# Description
sockstat-watch (cpp-sockstat-watch) is a Linux kernel socket statistics monitor written in C++23 with zero external dependencies. It reads /proc/net/sockstat and /proc/net/sockstat6 for: global sockets used counter, and per-protocol (TCP, UDP, UDPLITE, RAW, FRAG + IPv6 variants) fields inuse, orphan, tw (TIME_WAIT), alloc and mem (kernel pages, x4 KiB). Aggregate summary: total inuse, TIME_WAIT, orphans and socket memory with automatic KiB/MiB/GiB conversion. ASCII TIME_WAIT pressure bar relative to soft-limit 2000 (ephemeral port exhaustion warning under short-lived traffic). Watch mode (--watch N) with snapshot deltas (+N/-N on sockets, inuse, tw, orphan). JSON output (--json) with timestamp, totals and protocols array, validatable via python3 -m json.tool. --demo with high synthetic load (842 sockets, TW 1550). --no-color with mutable ANSI palette (0 codes in pipes). Built-in selftest: sockstat line parser, demo, JSON, real /proc read and no-color mode. Zero deps: g++ -std=c++23 -O2 -Wall -Wextra.
# Key features
$ Reads /proc/net/sockstat + sockstat6: sockets used and per-protocol TCP/UDP/RAW/FRAG (+IPv6)
$ Rich TCP fields: inuse, orphan, TIME_WAIT (tw), alloc and mem in kernel pages
$ TIME_WAIT pressure bar vs soft-limit 2000 — ephemeral port exhaustion warning
$ Watch mode (--watch N) with snapshot deltas on sockets, inuse, tw and orphans
$ JSON output (--json) with full snapshot: totals + protocols array
$ --demo with high synthetic load and --no-color with mutable ANSI palette
$ Selftest: line parser, demo, JSON, real /proc read and --no-color check
$ Zero dependencies: direct g++ -std=c++23 build, ideal for containers and VMs
# Gallery
# Technologies used