Added error checking for getaddrinfo()
Updated error checking for connect()