Don't use Socket.gethostname as it won't play nice with aliasing.

I'm not a rubyist; the suggested code is fair game.