0

I have a computer with a few different internet connections. LAN, WLAN, WiFi or 3G. All of these are active and the machine can use any of them.

Now I want to tell my application to use one of the available connections. For example I want to tell my application to use only WiFi while other software might use something else.

And before telling application we select a internet and want to check that selected internet is working fine or not. So how we can check selected internet is connected.

1 Answers1

0

Check the answers here: Choose one of many Internet connections for an application

However, is there any reason to specify network interface? If there are several network adapters, the WebClient or any other implementation will use interface with better metrics which you can retrieve by following code:

NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface adapter in adapters)
{
    Console.WriteLine(adapter.Speed);
}

Adapter with better speed will be used by default, so you don't have to be afraid that 3G will be used instead of Wi-Fi or Wi-Fi instead of the Ethernet.

Radim Göth
  • 167
  • 1
  • 5