Optimal Access Point Selection and Traffic Allocation in IEEE 802.11 Networks