views:

241

answers:

1

I am working on a program which will be used on mobile devices (Full Windows install) that may have 3G connectivity. If the particular device does have 3G connectivity, we would like to take advantage of it. However, the program should be able to prioritize communication based on what type of connection and speed are currently available.

I am able to get a list of the network interfaces using System.Net.NetworkInformation.NetworkInterface, but is there any good way to see if the interface is cell data, wireless, or regular ethernet as well as the available speed (particularly in the case of cell data)?

A: 

This will list all of the network connections that are currently up. It should be a place to start.

var interfaces = NetworkInterface.GetAllNetworkInterfaces()
    .Where(n => n.OperationalStatus == OperationalStatus.Up)
    .Select(n => new { Nic = n, Speed = n.Speed });
Matthew Whited
Should throw in NetworkInterfaceType, it should tell him if its cellular or not. http://msdn.microsoft.com/en-us/library/system.net.networkinformation.networkinterface.networkinterfacetype.aspx
sixlettervariables
I am already able to get this info. Problem being that A) the speed seems to be the maximum speed for the interface and B) the InterfaceType for a cell device would be...? Ethernet is obvious, but I don't know what type cell would appear as.
Totty
@Totty: What device are you using? The network interface may only provide info that it has. You may have to enjoy the world of WMI or pInvoke to get more information.
Matthew Whited
@six: I just showed those two values for an example. I figured he would be able to poke around and get whatever he wants.
Matthew Whited
The device is a Panasonic CF-U1 with a Sierra Wireless MC5725 card. However, this card may be replaced with other cards based on the customer's wireless carrier.
Totty
What does that device report back under GetAllNetworkInterfaces()?
Matthew Whited