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
Post a Comment