python - socket.gethostbyaddr giving different returns -


i'm using python 2.7.9 , while trying use socket.gethostbyaddr, found perplexing behavior.

my local computer has public ip, let's 111.111.111.111. if use on remote computer:

import socket socket.gethostbyaddr('111.111.111.111')[0] 

i 'mycomputer.com'. however, using same command on local computer (or using 127.0.0.1 instead of public ip), instead 'mycomputer.com'. why there difference in capitalization?

gethostbyaddr query hosts file - /etc/hosts on linux; windows has equivalent @ %systemroot%\system32\drivers\etc\hosts (location may vary older versions of windows)

from remote computer, gethostbyaddr doing dns lookup , getting mycomputer.com. on local computer getting answer hosts file, contains upper case version of hostname.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -