step <(E-Mail Removed)> wrote:
> i means it can only get my own hostname,all other ip'hostname
> can't ,it return null and p_errno=1
Probably want to check the settings in places like /etc/nsswitch.conf
to see if your "name resolution" stuff is configured to use anything
other than "files" (eg /etc/hosts). I'd have thought it would use the
same entries as gethostbyname, but stranger things have happened I
suppose. You could also try taking a system call trace of your code
to see which files are being examined for settings and/or values.
You could also try the experiment of adding a test entry in your
/etc/hosts file and see if your gethostbyaddr() call can find it.
And as someone else points-out, folks using
gethostbyname/gethostbyaddr should really be using
getaddrinfo/getnodeinfo these days. Even if the application isn't
interested in IPv6 yet, the newer interfaces are IMO nicer to use, and
someday someone, perhaps even you, will want the app to work with IPv6
rick jones
--
firebug n, the idiot who tosses a lit cigarette out his car window
these opinions are mine, all mine; HP might not want them anyway...

feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...