locked
Determining N/W Status Change across Multiple Interfaces

    Question

  • We are working on  Windows RT application which needs to:

    1. Handle the n/w status change events and send modified data only on changed interface.
    2. The host supports Ethernet, Wi-Fi connections both with and without internet access, but all the time with local network connection enabled. BT is disabled:

    N/w Status Change Handler:

    1. Once event notification is received, call GetConnectionProfiles() to get information on various available profiles and activity level.Get the “Network Adapter ID” of the “Profile” for which the “Connectivity Level” is non-zero.
    2. Call GetHostNames() to get host interface details and compare with n/w adapter ID for which “Connectivity Level” was non-zero and get the IP address from “HostNames” pool for the same.
    3. Try to send the modified data on the IP address got from point 2.

    We have 2 Questions:

    1. GetConnectionProfiles() provides me the profile for which “Connectivity Level” is non-zero. But, when I call GetHostNames(), none of the hosts provide me the n/w adapter ID matching with the ID got by GetConnectionProfiles() for which the connectivity level was non-zero. (Validation fails at “Host->Type” not being equal to IPV4.)
    2. If there is non-zero activity on both Wi-Fi and LAN, how  do we determine, on which n/w interface exactly the n/w change event happened, so that we handle the change exactly on the same interface.

    Thanks.

    Monday, August 05, 2013 5:22 AM

All replies

  • Can you help us understand your scenario such that you need to know this level of detail?  That is, what is your app doing that the network adapter is an important part of the app?

    Looking at my own machine, I can see that I have a connection profile with Internet connectivity access with a certain adapter id; when I look at my hostnames I see both an IPv4 and IPv6 hostname whose adapter Id matches the one in the connectivity namespace.  Are you also checking for IPv6?

    Note that the network change events are filtered: there's not a one-to-one correspondence between a "network event" and your app being notified.  Among other things, when network adapters come up, they tend to fire a lot of low-value events, one after the other.  Instead of blasting apps with a lot of events, one after the other, we try to provide the "last" event.


    Network Developer Experience Team (Microsoft)

    Monday, August 05, 2013 7:45 PM
  • Please find my answers inline to your queries:

    • Can you help us understand your scenario such that you need to know this level of detail?  That is, what is your app doing that the network adapter is an important part of the app?

    I need to keep track of changes on my system’s n/w interfaces. (Eg: Wi-Fi connection being switched across different Access points or Ethernet getting connected or disconnected) and send some specific data only on the interface that changed most recently. So, whenever I receive event notification for n/w interface change, I  would expect a change either in my Wi-Fi or in Ethernet connection, so that I send modified data only on the changed interface and keep communication on rest of the n/w interfaces same. Pls note: BT is disabled all thr’ this experiment.

    • Looking at my own machine, I can see that I have a connection profile with Internet connectivity access with a certain adapter id; when I look at my hostnames I see both an IPv4 and IPv6 hostname whose adapter Id matches the one in the connectivity namespace.  Are you also checking for IPv6?
    1. After I get Event notification, I call GetConnectionProfiles() and check if any of the profiles show non-zero activity. If yes, I call GetHostNames() to get host details. I am checking only for IPv4.
    2. If host name’s type matches IPv4, I go ahead to check for “IPInformation” and “IPInformation->NetworkAdapter”’s network ID. I manually change the Wi-Fi Access Point connection to a different AP, But, although I get non-zero activity on one of the profiles returned by GetConnectionProfiles(), none of the hosts in the host pool returned by “GetHostNames()” match the IPv4 type. Hence, validation fails and I cannot send the necessary data to the new Access Point even though the connection to new AP was successful.
    • Note that the network change events are filtered: there's not a one-to-one correspondence between a "network event" and your app being notified.  Among other things, when network adapters come up, they tend to fire a lot of low-value events, one after the other.  Instead of blasting apps with a lot of events, one after the other, we try to provide the "last" event.
    1. So this means, if there are some changes happening on Ethernet, BT and Wi-Fi within a very short interval. host may get notified of changed events for only one of the interfaces.?
    2. For Eg: After my host gets connected to a new AP, some changes happened on Ethernet triggers few events. In this case, I’ll receive an event notification for some changes happening on Ethernet. And there is a possibility that changes on Wi-Fi may never get notified to my event handler? or I'll receive 2 notifications within a certain interval?

    Thanks,

    Poornima

    Wednesday, August 07, 2013 12:04 PM
  • Can you provide us with a mail ID or contact no: where in we can have a direct discussion on this topic and have a logical conclusion on this issue. Thanks.
    Monday, August 12, 2013 5:53 AM
  • Please contact keithke (at) Microsoft.com and I will provide you with their contact information.  I'm on another thread with them about this issue.
    Tuesday, August 13, 2013 4:51 PM