Usually you don’t want to slow down your network connection deliberately. When testing networking applications, it might come in handy to simulate a worse network than you are actually on. This way you can simulate a 3G connection while actually running over WiFi.
Up until now, I used a Linux-box with netem and/or htb in the Queueing schedulers. Turns out that MacOSX can do most of this as well, using FreeBSD‘s ipfw pipes. Throtteling a single task only takes 2 commands:
$ sudo ipfw pipe 1 config bw 256kbit/s $ sudo ipfw add pipe 1 dst-ip 192.0.2.1 dst-port 80 33400 pipe 1 ip from any to any dst-ip 192.0.2.1 dst-port 80 $ sudo ipfw list 00100 pipe 1 ip from any to dst-ip 192.0.2.1 dst-port 80 65535 allow ip from any to any $ sudo ipfw pipe list 00001: 256 kbit/s 0 ms 50 sl. 1 queues (1 buckets) droptail mask: 0x00 0x00000000/0x0000 -> 0x00000000/0x0000 BKT Prot ___Source IP/port____ ____Dest. IP/port____ Tot_pkt/bytes Pkt/Byte Drp $ # do whatever you want $ sudo ipfw del 00100 $ sudo ipfw pipe del 00001