Less debug noise

Only output the fields necessary for debugging the remote requests.
Close the scope when returning 'Undefined'.
Change gethostbyname calls to getaddrinfo

* Mode away from the deprecated function call
* Leave space for string termination in the TCP buffer