Self-estimation of path-loss exponent in wireless networks and applications