Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Is there a good way to tell if you are connected to a network?


  • Please log in to reply
3 replies to this topic

#1 Mupeg

Mupeg

    New Member

  • Members
  • Pip
  • 1 posts

Posted 03 April 2011 - 05:13 AM

Howdy all, I am looking for a reliable way to tell if I am currently connected to a network at runtime. I have been looking through the Microsoft.SPOT.Net.NetworkInformation namespace and I am seeing a handler for a NetworkAvailabilityChanged event, but what I am really needing is a method to call that will tell me if I am currently connected to ‘any’ network. I see that there is a method that returns an array of network interfaces: Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces(); But this method returns one interface even when the Ethernet cable is not connected. Does this ‘default’ NetworkInterface contain any properties that are consistent and unique when there is not a network present so that I may test network availability based on that? Thanks in advance for your help.

#2 Shwaa77

Shwaa77

    New Member

  • Members
  • Pip
  • 1 posts

Posted 09 August 2011 - 01:17 PM

Hi

I was just wondering if you ever found a solution to this issue, as I'm sitting in the same predicament.

Any assistance would really be appreciated.

Howdy all,
I am looking for a reliable way to tell if I am currently connected to a network at runtime. I have been looking through the Microsoft.SPOT.Net.NetworkInformation namespace and I am seeing a handler for a NetworkAvailabilityChanged event, but what I am really needing is a method to call that will tell me if I am currently connected to ‘any’ network.
I see that there is a method that returns an array of network interfaces: Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces();
But this method returns one interface even when the Ethernet cable is not connected. Does this ‘default’ NetworkInterface contain any properties that are consistent and unique when there is not a network present so that I may test network availability based on that?

Thanks in advance for your help.



#3 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 09 August 2011 - 04:00 PM

Are you using DHCP? Perhaps you can query the current IP address? Also, they may be network "connect" and "disconnect" events. Worth a look... Chris

#4 Edward

Edward

    Advanced Member

  • Members
  • PipPipPip
  • 38 posts
  • LocationLondon, UK

Posted 18 August 2011 - 10:42 PM

Are you using DHCP? Perhaps you can query the current IP address?

Also, they may be network "connect" and "disconnect" events. Worth a look...

Chris


In the desktop version of the framework there is NetworkInterface.GetIsNetworkAvailable Method which I'm finding difficult to do without.

It seems odd in MF to have envent that indicate a change in network availability but no property to indicate the current state. Is this an omission in MF or something (presumably hardware specific) that should be provided by a SecretLabs library function.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.