Fixes #3497


This iterates all interfaces to locate an IPv4 loopback rather than assuming fixed interface names.
Tested on OS X 10.6.8, CentOS 6.2 (64-bit) & Win XP SP2 (64-bit).