2010/08/22

Throttling Blizzard's Downloader App

So I caved and downloaded StarCraft 2. Or.. well I'm downloading it now. One thing I noticed is that it's doing the peer-to-peer distribution method via Bittorrent. Nice. Except their app doesn't allow you to throttle upload speeds. Suck. And once your upload is saturated your download slows to a crawl. Super suck. Since I don't have QoS settings on my airport (thanks Apple), I had to opt for local bandwidth throttling. Fortunately my Mac OS ships with ipfw (thanks Apple!). Here's the quick and dirty on how to do it. :)

# set up a pipe with your max speed
sudo ipfw pipe 1 config bw 40KByte/s

# send all outgoing traffic running to
# Blizzard's BattleNet port through your pipe
sudo ipfw add 1 pipe 1 dst-port 3724
>>>00001 pipe 1 ip from any to any dst-port 3724

sudo ipfw show
>>>00001  104027 103045648 pipe 1 ip from any to any dst-port 3724
>>>65535 3350789 3309133858 allow ip from any to any

# delete pipe when done
sudo ipfw delete 1
sudo ipfw show
>>>65535 3393042 3351064847 allow ip from any to any
That's it. All done. Right from the command line. When your download is complete just clear out your rule.