Connect to client if not already connected

Also moved the dns resolution up to controller so it happens only once
rather than for every call to SendMetrics