Added error handling for invalid  host name or host not found