resolve hostname to ip

Previously only ip could have been used as an address for the
target. Now it is resolded, but only the first IP returned by the
resolver is used.

Signed-off-by: Zeljko <zeljko@zwr.fi>