Optimising Application Performance in Ad Hoc Networks