Detect if Ethernet Cable is Connected
#1
Posted 25 June 2012 - 10:31 PM
#2
Posted 28 June 2012 - 06:53 PM
#3
Posted 10 July 2012 - 09:05 AM
#4
Posted 10 July 2012 - 03:49 PM
#5
Posted 11 July 2012 - 08:51 PM
using Microsoft.SPOT.Net.NetworkInformation; static bool isNetworkAvailable = false; static void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e) { isNetworkAvailable = e.IsAvailable; Debug.Print(DateTime.UtcNow.ToString("u") + ": " + (isNetworkAvailable ? "CONNECTED" : "DISCONNECTED")); }
from How to reboot netduino + from code on a socket exception
“Sometimes the questions are complicated and the answers are simple.”
~ Dr. Seuss
#6
Posted 09 August 2012 - 04:18 PM
#7
Posted 09 August 2012 - 04:35 PM
Hi,
for me is this not working at 4.2 RC5, the rutine NetworkChange_NetworkAvailabilityChanged is never called. Any help what to do?
You have connected the event handler to the relevant event?
Original post is here, you need a line like this in your main method:
NetworkChange.NetworkAvailabilityChanged += NetworkChange_NetworkAvailabilityChanged;
Nak.
#8
Posted 09 August 2012 - 06:43 PM
#9
Posted 03 February 2015 - 06:44 PM
I know this is old but I too would like to know if a cable is plugged in at start up. The changed event will only fire after start up and a cable is plugged in or out.
Is there any solution for this obvious need in 4.3?
Homey
#10
Posted 03 February 2015 - 07:46 PM
Are you using DHCP? If so, check your NetworkInterface for an IP address.
BTW this is definitely something we can support with Netduino.IP... We're not to UDP/TCP yet in the progressive preview, but we'd love it if you have a chance to test this out in a month or two when we get there...
Chris
#11
Posted 03 February 2015 - 07:53 PM
Unfortunately I cant use DHCP in my application. Sure, I would be happy to help test new stuff! Just let me know how and when. I do a lot of TCP and UDP sockets on my ND+2's now.
Homey
#12
Posted 03 February 2015 - 08:23 PM
Hi Homey,
Not sure if it is a feasible solution but why not sent a HTTP web request and check if you get a response within a certain time?
Surround the call with a try catch and done or is there something I am not understanding?
Cheers,
Beasty
Van SchOten Ict Diensten en Services
http://www.voids.nl
#13
Posted 03 February 2015 - 11:15 PM
in my applications the ND+2 is on a personal network with no router, etc (aka direct cable between a compy and ND+2). I suppose I could install IIS on the compy and try the http request idea but really the right answer is to implement the "IsConnected" var in networkinterface. That's really what im hoping the next firmware will do
#14
Posted 04 February 2015 - 12:26 AM
How about if we implemented this? If nothing else...as a separately-downloadable sample class?
https://msdn.microso...(v=vs.110).aspx
Chris
#15
Posted 04 February 2015 - 02:51 AM
Chris, that would be awesome! Anything is better than what im doing now which is try/catching socket bind exceptions.
Homey
#16
Posted 07 August 2015 - 05:59 PM
Hi Chris.
Was the
NetworkInterface.OperationalStatus Property ever implemented in one form or another ?
Thanks
Bill
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users