Detecting a 3G connection in Windows 7 and 8 in a desktop application
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Thread: Detecting a 3G connection in Windows 7 and 8 in a desktop application

  1. #1
    Join Date
    Feb 2012
    Posts
    7

    Detecting a 3G connection in Windows 7 and 8 in a desktop application

    Hi

    I am in the process of developing a cloud backup software. The application is a desktop application developed using C#.

    I need to add an option to stop/pause the backup if the computer was connected to a 3G network to save cost for the user.

    I cannot seem to be able to find any example on how this can be achieved, there are some examples for Windows Phone and Windows Store Apps but I cannot find anything that can check if the connection type is a WiFi/Ethernet or 3G the latter is my main concern.

    I tried a test application to enumerate the networks:

    Code:
    Console.WriteLine("checking network interfaces\n");
    
    NetworkInterface[] interfaces =  NetworkInterface.GetAllNetworkInterfaces();
    
    foreach (var networkInterface in interfaces)
    {
       Console.WriteLine("Interface Detected");
       Console.WriteLine("Description: "+networkInterface.Description);
       Console.WriteLine("ID: " + networkInterface.Id);
       Console.WriteLine("Name: " + networkInterface.Name);
       Console.WriteLine("Interface Type: " + networkInterface.NetworkInterfaceType);
       Console.WriteLine("Operational Status: " + networkInterface.OperationalStatus.ToString());
       Console.WriteLine("Speed: " + networkInterface.Speed.ToString());
       Console.WriteLine("Supports Multicast: " + networkInterface.SupportsMulticast.ToString());
       Console.WriteLine("#########################################################\n");
    }
    The above code list my 3G connection as PPP which can be either ADSL or 3G. I am not sure if I can differentiate using some other options or APIs.

    I need a clear way to distinguish between those networks and so far I cannot find a way of doing so.

    Can someone please help?
    Last edited by redserpent7; December 24th, 2012 at 07:16 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center