Could some C guru please help ? I am writing a Web server on RH 9.0
box. In the section of the code where the Web server has to be
initiialized, I have:
char host[128];
struct hostent *hp = NULL;
............... ...............
............... ............... .
if(gethostname( host, sizeof(host)) < 0)
{
/* Print error message and return -1 */
}
if((hp = gethostbyname(h ost)) == NULL)
{
/* Print another message and return -1 */
}
The second guard is always failing. I have tried 'nslookup' from the
command prompt and it works fine, by returning the name of the DNS
server.
Any hints or suggestions would be greatly appreciated.
box. In the section of the code where the Web server has to be
initiialized, I have:
char host[128];
struct hostent *hp = NULL;
............... ...............
............... ............... .
if(gethostname( host, sizeof(host)) < 0)
{
/* Print error message and return -1 */
}
if((hp = gethostbyname(h ost)) == NULL)
{
/* Print another message and return -1 */
}
The second guard is always failing. I have tried 'nslookup' from the
command prompt and it works fine, by returning the name of the DNS
server.
Any hints or suggestions would be greatly appreciated.
Comment