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.
From documentation, 
socket.gethostname returns a string containing the hostname of the machine where the Python interpreter is currently executing.
socket.getfqdn returns a fully qualified domain name if it's available or gethostname otherwise. 
Fully qualified domain name  is a domain name that specifies its exact location in the tree hierarchy of the DNS. From wikipedia examples:

For example, given a device with a local hostname myhost and a parent
  domain name example.com, the fully qualified domain name is
  myhost.example.com.
what's the difference between gethostname and getfqdn?