Had this problem recently, and fixed it by resetting winsock (I think this only works for Windows 7 and above)

Open CMD as admin

you can get at that from the start button (right click in Windows 8.1)

Type

netsh winsock reset

and hit RETURN

Restart computer

It worked for me, anyway, but YMMV!

This link gives more details

forum.thewindowsclub.com/.../35087-reset-winsock-windows-7-8-a.htm.