1

So I tried to get a host name from an IP address following this example

Thus, I wrote up this little snippet of code trying to reproduce their results

import socket

print(socket.gethostbyaddr('69.59.196.211'))

Yet the output to this particular piece of code is the following:

('peak-colo-196-211.peak.org', [], ['69.59.196.211'])

I'm completely at a loss as to why I'm not receiving the proper host name (or at least stackoverflow.com like in the example)

I'm certain I'm missing something exceptionally silly, but I've had difficulty finding an answer. I recognize that the provided example is old, but I get similarly crude/cryptic results no matter what I try. If someone could explain this to me I'd be extremely appreciative.

Community
  • 1
  • 1
Kanga_Roo
  • 297
  • 5
  • 13
  • Why do you think it should give `stackoverflow.com`? `[i[-1][0] for i in socket.getaddrinfo("stackoverflow.com", 0)]` gives `['104.16.33.249', '104.16.34.249', '104.16.36.249', '104.16.35.249', '104.16.37.249']`, none of them is your IP... – glglgl Feb 18 '16 at 13:50
  • Oh, I see. Well, I suppose that the IP address they use might have changed in the last nearly 6 years... – glglgl Feb 18 '16 at 13:51
  • None of those IPs returned stackoverflow for me either. But it's not just SO or the example IP, I get these really crude results for anything I try – Kanga_Roo Feb 18 '16 at 13:53
  • @Berry Any solution for the problem found I am getting similar response from the function call to get the hostname from the ipaddress passed – Tara Prasad Gurung Aug 31 '17 at 04:24
  • Unfortunately no :( – Kanga_Roo Aug 31 '17 at 14:41

0 Answers0