*BSD News Article 93185


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.mira.net.au!pumpkin.pangea.ca!eru.mt.luth.se!news-stkh.gsl.net!news.gsl.net!uninett.no!nntp.uio.no!newsfeeds.sol.net!newspump.sol.net!howland.erols.net!rill.news.pipex.net!pipex!tank.news.pipex.net!pipex!news.utell.co.uk!usenet
From: brian@shift.utell.net (Brian Somers)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: 2.2.1 libresolv.a - gethostbyname() always return NULL
Date: 8 Apr 1997 09:55:40 GMT
Organization: Awfulhak Ltd.
Lines: 28
Message-ID: <5id4ms$8md@ui-gate.utell.co.uk>
References: <5id2rj$75a@hpg30a.csc.cuhk.edu.hk>
Reply-To: brian@awfulhak.org, brian@utell.co.uk
NNTP-Posting-Host: shift.utell.net
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Newsreader: knews 0.9.8
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:38778

In article <5id2rj$75a@hpg30a.csc.cuhk.edu.hk>,
	ktso@dcns.csc.cuhk.edu.hk (SO Kwok Tsun) writes:
> As subject, I have upgraded one of our FreeBSD box from 2.1.7 to
> 2.2.1.  I notice a problem with the following program:
> 
> #include <netdb.h>
> #include <stdio.h>
> 
> main(){
>     if (gethostbyname("cuhk.edu.hk")==NULL)
>         printf("Null\n");
> }
> 
> and I compile it using "cc dns.c -lresolv".  It always return "Null".
> Anyone met the same problem?

You've got a resolver problem.  This program should work, and does
work for me ;)  It's easier to say "nslookup cuhk.edu.hk".

Do you have a nameserver running ?  If not, what do /etc/resolv.conf,
/etc/host.conf and /etc/hosts say ?

> So K T, CUHK

-- 
Brian <brian@awfulhak.org> <brian@freebsd.org>
      <http://www.awfulhak.demon.co.uk>
Don't _EVER_ lose your sense of humour !