I seem to remember being able to enumerate the interfaces on my host computer.
each interface may have one of more IP Addresses associated with it.
Does anyone know how to get a list of network interfaces and the ip addresses that are associated with each interface?
So assuming a host can have multiple interfaces each with their own ip addresses…
When you make a connection to a server it may only expect connections from a specific IP address.
So when you make a connection it would be wise to select an interface to use to establish the connection?
well it depends on what you call an interface. a physical network card interface can have multiples by adding virtual interfaces (logical) onto the same physical one.
I am not sure if System.GetNetworkInterface(i) is the physical interfaces or the logical ones. I am going to guess logical based on their code.
[quote=209661:@Brian O’Brien]Thanks Scott… So am I mistaken to believe that an interface can have more than one IP address?
cheers.
B.[/quote]
You are.
Is there a way to determine the interface index given an ip address?
I mean, when I connect the connection has to come for the IP address that the client is expecting it to come from or it will drop the connection. (Security)
Maybe I should shell to ifconfig or ipconfig to 'fig’ure this out?
have you checked to see if System.GetNetworkInterface(i).IPAddress doesn’t work for you? I am lazy so I wold check to see if that works as it is easy to get the IPs out of. otherwise you are parsing cli output and from O/S version to version the output can change breaking your app.