N
Neil
Hi,
I have a c# app that binds to a port on the host machine.
How do I determine the IP address of the active network interface?
On a PC with multiple NICs I can obtain a list of IP addresses as follows:-
string hostName = Dns.GetHostName();
IPHostEntry local = Dns.GetHostByName(hostName);
foreach (IPAddress ipaddress in local.AddressList)
{
Console.WriteLine(ipaddress .ToString());
}
This gives me a list of the available IP addresses on the host available on
all the network interfaces.
But how do I determine which of these addresses belongs to the active
netwrok interface?
Thanks
Neil
I have a c# app that binds to a port on the host machine.
How do I determine the IP address of the active network interface?
On a PC with multiple NICs I can obtain a list of IP addresses as follows:-
string hostName = Dns.GetHostName();
IPHostEntry local = Dns.GetHostByName(hostName);
foreach (IPAddress ipaddress in local.AddressList)
{
Console.WriteLine(ipaddress .ToString());
}
This gives me a list of the available IP addresses on the host available on
all the network interfaces.
But how do I determine which of these addresses belongs to the active
netwrok interface?
Thanks
Neil