Question

I'm seeing on Windows Server 2008 that even if AddIPAddress succeeds, I cannot bind immediately after a socket to the requested address: I get WSAEADDRNOTAVAIL, and I have to wait at least several seconds to make a successful bind. Even if I hack in a system("netsh in ip add address ...") I get the same problem, so it's a system wide effect.

Does anyone know more about this? Is there a way to "atomically" add an ip address to an interface?

Était-ce utile?

La solution

It takes times to update the IP tables with the new IP and propagate that through the system. You will just have to wait for it to finish. Call bind() in a loop until it stop reporting WSAEADDRNOTAVAIL, or until a timeout of your choosing elapses.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top