Dynamic Control and Optimization of Buffer Size in Wireless Networks