Just in case, someone else came across this question, I answer it.
Unfortunately, connecting to any address is not allowed on Windows.
The Winsock connection function will return the WSAEADDRNOTAVAIL error code [The remote address is not a valid address (for example, INADDR_ANY or in6addr_any)], as indicated in the Windows API Documentation :
If the structure address member specified by the name parameter is filled with zeros, the connection will return a WSAEADDRNOTAVAIL error.
Therefore, without using any localhost address, I think that what you are trying to do will not be possible on Windows (although I am wondering if the Unix behavior is buggy or intentional.).
I would suggest setting up additional loopback interfaces, as suggested by Mark Reed in comment .
source share