a c++ implementation of netrate algorithm