Replaced use of perror() with herror() for obtaining error message of gethostbyname()