Just the title, what the difference between them?
In python, socket.gethostbyname(socket.gethostname()) and socket.gethostbyname(socket.getfqdn()) return different results on my computer.
Just the title, what the difference between them? In python, socket.gethostbyname(socket.gethostname()) and socket.gethostbyname(socket.getfqdn()) return
Share
From documentation,
socket.gethostnamereturns a string containing the hostname of the machine where the Python interpreter is currently executing.socket.getfqdnreturns a fully qualified domain name if it’s available orgethostnameotherwise.Fully qualified domain name is a domain name that specifies its exact location in the tree hierarchy of the DNS. From wikipedia examples: