none
NmGetAdapterCount() return count 0 RRS feed

  • Question

  • Hi!

    I try to use the Network Monitor API from Java.

    I have a C++ class which runs perfect in my non-Java environment.

    But on the same system if the class is used in a Java program the function NmGetAdapterCount() always returns sucessfully but says that there is no adapter in the system. (GetAdaptersAddresses() returns the right number and description for the installed network adapters).

    Is there any way to get more info why NmGetAdapterCount() delivery count 0 (it sets the variable points to to 0)? DebugView does not give any info? Is there a debug level?

    My development environment is: Windows XP (with latest updates) with Network Monitor 3.4, Visual Studio 2008, Java 1.6 (latest updates).

    Thanks for help!

    Joe

    Friday, February 17, 2012 4:31 PM

All replies

  • Hi Joe,

    We haven't done any testing with a Java interface.  Is there some tool you're using for Java to call our library?

    By 'GetAdaptersAddresses' are you referring to 'NmGetAdapter' and it's structure or some other call in another library?  It could be a permissions issue with your user account (do you see the adapters in Netmon itself? You need to be part of the Netmon Users security group), or with how Java represents you to our API...?

    If you provide a few more details, maybe we can figure something out, but this is new ground for us.

    Thanks,


    Michael Hawker | Program Manager | Network Monitor

    • Proposed as answer by Paul E Long Friday, April 4, 2014 3:40 PM
    Friday, February 17, 2012 9:49 PM
    Moderator
  • Hi Michael

    I face a similar problem:

    1) Using Netmon app I can see 5 network adaptors - so OK

    2) Using console application written in VS 2010 (C++ OR C#) and NmGetAdaptorCount API (using NMAPI.DLL) I can get 5 adaptors - So OK

    3) Using a Unit test (C#) or Coded UI test (C#) NmGetAdaptorCount returns ERROR_SUCCESS but with count = 0 - NOK (I was expecting 5 as in step 1 and 2)

    Not sure what is happening with (3). Do we need to set some security attributes on the process (NUnit, Coded UI process)?

    Kind Regards

    Praveen

    Wednesday, March 19, 2014 6:04 AM
  • Hi Praveen,

    I don't work on Netmon anymore and everything's moving to the new Message Analyzer now, but I remember we had a section in the included Netmon documentation about working with C#. 

    I think you had to specify the STA property for threading on the main class.  And I believe you may need to run your application with administrative privileges in order to be able to capture (and get that info).

    Hopefully those can help unblock you.  There shouldn't be anything else I can think of, the C# wrapper just calls the native C++ library.

    Thanks


    Michael Hawker | Program Manager | Network Monitor

    Wednesday, March 19, 2014 8:31 PM
    Moderator