Dynamic selection of server ports