System:
Issue:
Tried:
gethostbyname("mylocal.example.com");
comes back with the domain name itself as result /etc/hosts
file. Restarted network since then a few times. Question:
The same domain name is returned by gethostbyname function only when its not able to resolve that host.
To resolve a non-existent domain name from host file add a trailing dot to the domain name. Eg gethostbyname(“mydomain.com.”);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.