Added check for ip or hostname
Use interpolation instead of join
Marco Ceppi 2013-02-12 Added check for ip or hostname