#!/usr/bin/python

from __future__ import print_function
import subprocess
import sys

conns = len(sys.argv) > 1 and int(sys.argv[1]) or 1000
limitrate = len(sys.argv) > 2 and sys.argv[2] or "1M"
url = len(sys.argv) > 3 and sys.argv[3] or "http://localhost:8080/finale.mp3"
for i in range(conns):
    subprocess.Popen(["curl", "--limit-rate", limitrate, "-o", "/dev/null", "-s", url])
    print("opened curl no. {0:d}".format(i), file=sys.stderr);
