_X11TransSocketINETConnect() can't get address for localhost

I connected a CentOS 5 box using PuTTY and ran emacs, but I got the following error.

------------------------------------------------------
$ emacs
_X11TransSocketINETConnect() can't get address for localhost:6011: Name or service not known
emacs: Cannot connect to X server localhost:11.0.
Check the DISPLAY environment variable or use `-d'.
Also use the `xhost' program to verify that it is set to permit
connections from your machine.
---------------------------------------------------

I use Xming as an X server on Windows XP. I checked the X11 option of PuTTY, the sshd setting, and the firewall setting. All the settings were okay. According to the error message, the problem is that the name of "localhost" is not resolved. I took a look at the /etc/hosts file and found the file was empty. So I added the following line to the file.

127.0.0.1 localhost.localdomain localhost

The problem is fixed. I don't know why the file is empty though...

Good Bye, Folks!

As you may have heard, Fujitsu has completely discontinued Data Center Products and Solutions business in North America on April 1st, 2021. ...