Getting the local address for connection on a multihomed machine.
Hi, I need to be find out the IP address which I will be using to talk to a given target address on a machine that can have multiple interfaces and multiple addresses on those interfaces. I need this because I have to state my own address in the payload I'm sending. (I don't need to work through NAT)
I have the IP helper functions GetBestInterface() and GetBestRoute() which will tell me the Interface that will be used to talk to a given host, but I can't find a way of getting which IP Address on that interface will be used. From what I can tell from the reference material, I cannot rely on there being only one IP address assigned to any one Interface.
I'm new to Windows, is it just a library function that I haven't found, or is it that I'm going about this in the wrong way? It seems like it should be a pretty common thing to want to do.
Any thoughts greatly appreciated.
-Graham Richards

