Is there a good way to tell if you are connected to a network?
#1
Posted 03 April 2011 - 05:13 AM
- Shwaa77 likes this
#2
Posted 09 August 2011 - 01:17 PM
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
Posted 09 August 2011 - 04:00 PM
#4
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