Update connection.c

it's better to check and resolve the connection use the FQDN first instead of ip address, due to the issue of getting internal ip address that's getting "Resource Access Denied" response.