I have a PHP script that uses `fsockopen(localhost, ...)' to open a socket connection to another server residing in the same machine. It works beautifully in GNU+Linux hosts but not in Windows Vista.
Narrowing down the problem by turning off the Windows' firewall, checking the server to be contacted, and reinstalling the PHP, I was quite sure that the problem laid somewhere in the Windows Vista itself.
Googling with keywords "fsockopen problem in vista" directly hit the answer:
http://bugs.php.net/44335 (PHP Bugs: #44335: fsockopen on localhost on Vista)
It seems that the improper way Windows Vista translates `localhost' to `127.0.0.1' confuses PHP 5.2.5, 5.2.1, 5.1.6, 5.0.3, but not 4.4.8.
The solution is simple. Either I do `fsockopen('127.0.0.1', ...)' or just fix the culprit by commenting out `::1' from `C:\windows\system32\drivers\etc\hosts'.
Well, it is simple but I spent four hours to get to the answer.
Moral of the story:
1. Always google for the answer first with the _right_ keyword. Yes, two hours into the problem, I googled for `fsockopen timeout in windows'. I found no answer because I didn't include the magical keyword: `vista'.
2. DON'T use Windows Vista, that bloated badly-configured OS (http://badvista.org). Use GNU+Linux and grasp your software freedom :-)