Almost complete implementation of StatsSocket