Hi all,
I have been trying to achieve something similar with what it is asked in the following thread:
http://social.msdn.microsoft.com/Forums/en-US/netfxnetcom/thread/a7a540cf-55a9-4d8d-9cb0-8dfdc5b1f704In particular I have a pc running Windows 7 with two network interfaces, both of which are 3G usb modems. I have written a trivial c# application that creates a socket and connects to a remote server. What I want to do is to force the connection go through the interface I want every time. For that reason I am using the Bind methond (after creating the socket and before connecting it to the server) and as argument I input the IP of the interface I want the connection to pass through and "0" port in order for the OS to assign a port to the socket. Whenever I specify the IP of the default interface (the interface with the smallest metric for the 0.0.0.0 destination at the routing table) everything works fine, i.e., I can see the packets being exchanged using netmon. However, whenever I specify the IP of the non-default interface as an argument at the Bind method no packets are being exchanged. Based on some other testings I performed it seems that the source ip of the packet is correctly set to the one I want but the OS tries to push it out from the default interface and not from the one I want and as a result it is not being sent out (since the source ip and the interface's ip do not match).
I have read in various forums and links that Windows 7 support by default the Strong Host Send and as a result the above should be enough to achieve my goal. However the results are not the expected ones. Even though, strong host send/recieve is said to be the defaul operation for win 7 I have manually disabled weak host send using netsh. I have also taken care of having entries to 0.0.0.0 destination for both interfaces.
Is there something more I need to configure for achieving my goal? It seems so easy but I have been struggling with it for long time now (before trying out sockets in c# I had even tried WFP and callout drivers).
I hope it is just a matter of misconfiguration and someone will be able to help me out :)
Thanks