I found tc, which allows you to filter by ip, port etc. and then limit rates. But I was wondering if there was anything that could filter by application or limit rate given another process' socket ..
ok seems like
I can use lsof -iTCP and ipfw pipes ... wonder how efficient that is ..
lsof -iTCP: http://danielmiessler.com/study/lsof/
with rate limiting (dummynet): http://www.opensource.apple.com/source/network_cmds/network_cmds-115.2/ipfw.tproj/ipfw.c