Saving remote host and port in connect function