connect by domain instead of by ip

The IP address could change sometime in the future, better be safe and connect through the domain.

The code is *UNTESTED*!! Please, test it works correctly before merging.