0

gethostbyname() and gethostbyaddr() are both returning different h_name values in their returned hostent structs when I call them in my program. I'm wondering if this behaviour is normal or should the two return identical host names?

Vimzy
  • 1,871
  • 8
  • 30
  • 56
  • Q: What are the values? Are they both valid? – paulsm4 Jan 13 '16 at 05:59
  • @paulsm4 For example, when I run it on "www.wwe.com" I get "wwe.com" as the host. But when I use their IP Address "54.236.192.188" I get "ec2-54-236-192-188.compute-1.amazonaws.com" as the host name. Is the error in my coding? Or is this just a problem with these functions? – Vimzy Jan 13 '16 at 06:01
  • 2
    This is normal, a host may have many names. – n. m. could be an AI Jan 13 '16 at 06:09

0 Answers0