we are finding problems getting hostname and host address with the API gethostbyname() and gethostbyaddr().
If we pass the address of windows m/c , we are getting the proper result, but if we pass the address of a qnx m/c, we are getting NULL.
Similarly if we ping a qnx m/c with the hostname, we are not able to ping, but if we ping with the ip address , it is able to ping.
I have tried modifying the /etc/hosts and /etc/resolv.conf.
Does neone has soln to these 2 problems.
You need set “lookup file bind” to indicate looking into /etc/hosts before asking DNS.
In which file should we set “lookup file bind”???
I have given the IP address and hostname in /etc/hosts file as:
10.10.16.48 rabbit.xyz.com rabbit
and name server and lookup_file_bind in resolv.conf
/etc/resolv.conf file is:
Is there anything else to do after this.
I am able to ping the same m/c with the hostname but others are not able to ping that m/c with the hostname???
What may be the problem??
In order for others to be able to ping you with the name, they have to either have your name/IP address in their /etc/hosts file, or you should ask your administrator to add your hostname to the DNS servers.