Simulating Dial-Up Connections

I often find myself wondering how my sites will work on dial-up connections, and I’ve long been looking for a good way to simulate it in OS X. I recently came across the ip_relay Perl script by Gavin Stewart. It isn’t quite perfect; it seems to have problems with larger files in particular. I was streaming MP3s with it, and it would often cut out for long periods of time, not sending any data at all. Nevertheless it was very helpful, even if it did simulate a far slower connection than I’d asked it to.

It’s very easy to use. Simply download the script, and open the Terminal application in your Utilities folder. In Terminal, type cd followed by a space. Then drag the ip_relay folder (the one that contains the script) to the Terminal window. Hit return. That will change the directory, making things easier. From there you simply type a command like this:

./ip_relay -b 5000 8000:domain.com:80

If everything works as expected, you simply point your browser to http://localhost:8000 and you’ll have a painfully slow mirror of domain.com there.

5000 is the maximum number of bytes per second, so in this example I’m simulating a 40 kbps connection. 8000 is the local port number. You can use something else if you like but you’ll want to make sure it’s not already in use. 80 is the port of the site you’re simulating… Chances are you’ll want to use 80, unless it’s a secure site (use 443) or you’re doing something a bit different.

Domain.com is the domain name, of course… If you want to use it on your own computer’s server, just enter localhost instead. This may be necessary, as many hosts use virtual servers, which rely on the domain name you enter in your address bar in order to show you the correct site. If I enter tenseforms.com, for example, I just get the default Apache page instead of the actual site. Since OS X has Apache built in, it’s relatively painless to set up your own server and test using that instead.

If you have any other suggestions for simulating dial-up connections on OS X, I’d love to hear them. There are a couple of Apache modules called mod_bandwidth and mod_throttle, but I’ve yet to try them. For me the big appeal of ip_relay is that it’s so easy to set up and use. From what I can tell of the Apache modules, that isn’t quite the case.

Comments

This entry has no comments.

View more

Code

VoiceOver tips for iPhone developers I’ve been working on improving VoiceOver support for Delivery Status touch 3.0. It was…

My First WWDC Above: Apple’s live App Store wall at WWDC. It showed icons of 20,000 iPhone apps,…

Displaying a password or text entry prompt on the iPhone Writing your own iPhone or iPod touch app, and wondering how to create an alert like…

Junecloud: coming soon