This topic is now archived and is closed to further replies.


gethostbyname strange phenomena

Recommended Posts

Granted this is more of a programming question more than a network question, I just thought maybe someone would have a clue. Here''s the situation. In C, normally when one wants to get an IP adddress they would do a gethostbyname call and use the returning structure to access the ip field. However... on some systems one can alter the /etc/hosts file to change the hostname (mild change, let''s say change your server name from xname to Once this is changed, gethostbyname seems to not work anymore. Can anyone think of anyways to get around this, or an explanation of why? Thanks.

Share this post

Link to post
Share on other sites