Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Problems with network interfaces

Problems with network interfaces

Scheduled Pinned Locked Moved C#
performancesysadmintutorialquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Chen Pang
    wrote on last edited by
    #1

    I'm writing a program that needs to list all network interfaces in the computer and detects their speed. I tried performance counter related classes in Diagnosis namespace, but many unexpected problems occured. can someone tell me how to do it right? any advice appreciated.

    H 1 Reply Last reply
    0
    • C Chen Pang

      I'm writing a program that needs to list all network interfaces in the computer and detects their speed. I tried performance counter related classes in Diagnosis namespace, but many unexpected problems occured. can someone tell me how to do it right? any advice appreciated.

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      Um, why don't you tell us what problems occured. Exception messages, incorrect behavior versus expected behavior, and stuff like that. Ever try to provide support to someone saying only "I have a problem"?

      Microsoft MVP, Visual C# My Articles

      C 1 Reply Last reply
      0
      • H Heath Stewart

        Um, why don't you tell us what problems occured. Exception messages, incorrect behavior versus expected behavior, and stuff like that. Ever try to provide support to someone saying only "I have a problem"?

        Microsoft MVP, Visual C# My Articles

        C Offline
        C Offline
        Chen Pang
        wrote on last edited by
        #3

        First, I don't know the correct way to enumerate network interfaces on a computer, so I used existing performance counters, and calculate the network speed in a brute forcing manner. One problem is that a "MS TCP loopback interface" exists on every computer. I gave my program to some friends, and they told me it won't work with dial up network and some ADSL network, so I don't know the exact exception message.

        H 1 Reply Last reply
        0
        • C Chen Pang

          First, I don't know the correct way to enumerate network interfaces on a computer, so I used existing performance counters, and calculate the network speed in a brute forcing manner. One problem is that a "MS TCP loopback interface" exists on every computer. I gave my program to some friends, and they told me it won't work with dial up network and some ADSL network, so I don't know the exact exception message.

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          Then why don't you ask them. Something else you should look into is WMI, which uses the System.Management namespace for classes in .NET. There is a Win32_NetworkAdapter WMI class that allows you to get all the information for adapters. Even my WAN interfaces show up when querying the class for instances. You can use the mgmtclassgen.exe utility that comes with the .NET Framework SDK to generate a class file (not an assembly like the interop utilities do), or download and install the WMI Extensions for Visual Studio .NET 2002[^], which allows you to browse all the classes and even generate source files in your project. For more information, look up the System.Management namespace in your help documentation for the .NET Framework SDK (or the Visual Studio Combined Collection), or read the following article, System.Management Lets You Take Advantage of WMI APIs within Managed Code[^].

          Microsoft MVP, Visual C# My Articles

          C 1 Reply Last reply
          0
          • H Heath Stewart

            Then why don't you ask them. Something else you should look into is WMI, which uses the System.Management namespace for classes in .NET. There is a Win32_NetworkAdapter WMI class that allows you to get all the information for adapters. Even my WAN interfaces show up when querying the class for instances. You can use the mgmtclassgen.exe utility that comes with the .NET Framework SDK to generate a class file (not an assembly like the interop utilities do), or download and install the WMI Extensions for Visual Studio .NET 2002[^], which allows you to browse all the classes and even generate source files in your project. For more information, look up the System.Management namespace in your help documentation for the .NET Framework SDK (or the Visual Studio Combined Collection), or read the following article, System.Management Lets You Take Advantage of WMI APIs within Managed Code[^].

            Microsoft MVP, Visual C# My Articles

            C Offline
            C Offline
            Chen Pang
            wrote on last edited by
            #5

            thanks a lot ^^

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups