Browser slow to connect to localhost on Vista
Posted by pcfinch on July 11, 2008
I’m developing a little HTTP server in C++ on vista (don’t ask why). Anyway, I found that my browser was REALLY slow when trying to connect to the localhost server “http://localhost:8282/” but not the local IP address “http://127.0.0.1:8282/”. When I say slow, I mean about 1 second per connection. A bit of hunting around and I found the following lines in the \windows\system32\drivers\etc\hosts file.
127.0.0.1 localhost ::1 localhost
I didn’t recognize the last line or know what it does… so I commented it out (I live life on the edge some time!!). Anyway, things sped up! e.g.
127.0.0.1 localhost # ::1 localhost
You’ll have to edit the hosts file as the administrator as it’s protected, but this simple little fixed work for me. If your having a similar problem, I hope this helps you too.