Allocating bandwidth to applications