Bind to Adapter Functionality on the Windows Platform

The following is a note from a Chilkat customer, reproduced with permission:

“Here is some info you might find interesting.

As you may know, we’ve run into strange problems while trying to use the ‘bind to adapter’ functionality (i.e. ClientIpAddress property) of Chilkat (HTTP and FTP).  On Windows 7 it worked fine, but on Windows XP it did not. The packets would go out on the wrong adapters, but contain the correct adapter’s IP in them, which led to communication failure.

After some research, we’ve found an article about the behavior of Bind on Windows XP vs. Windows 7. It turns out Windows XP uses a “Weak Host Model” while Windows Vista and above use a “Strong Host Model”. This is basically a security-related change that is part of the full rewrite of the TCP/IP stack in Windows Vista (Next Generation TCP/IP Stack).
If you’re interested in reading about this, here are two links:
http://blogs.technet.com/b/networking/archive/2009/04/25/source-ip-address-selection-on-a-multi-homed-windows-computer.aspx
http://technet.microsoft.com/en-us/magazine/2007.09.cableguy.aspx

To summarize what’s detailed in these articles – in the weak host model, the stack allows packets having any ip to be sent or received over a certain interface. In the strong host model, only packets with the IP belonging to the interface may be sent or received on it. Furthermore, in the weak host model Windows uses the routing table to decide which interface to use. This means that if you were to bind to a specific interface but the routing table indicates a different one, you would get packets going out of the second interface (indicated by the routing table) but using the IP of the first interface (indicated by bind) – in a normal network configuration (different ports connected to different networks) this will cause the communication to fail. On Windows 7 everything should behave as expected.”