How to check if ethernet is connected?
#1
Posted 19 February 2012 - 08:44 PM
#2
Posted 23 February 2012 - 02:54 AM
#3
Posted 23 February 2012 - 03:33 AM
#4
Posted 29 October 2012 - 02:00 PM
#5
Posted 29 October 2012 - 03:16 PM
ntools
TCP Listener (Beta) · FTP Server (Alpha)
Netduino Plus Go Module · Xml Parser
http://ntools.codeplex.com/
#6
Posted 29 October 2012 - 05:10 PM
Except from NetworkAvailbilityChanged event, which cannot be used to detect the initial state, I suggest making somekind of request, wrapped in a try-catch ... if it fails, no network.
Thanks,
but it is exactly what i don't want. Let's explain myself:
The network can be down or unplugged.
When I'm trying to do the Socket.Connect, my ND+ is totally stuck (and all my threads ...)
It seem's to be a well known bug (corrected in MF 4.3 beta)
http://netmf.codeple...m/workitem/1396 for more info
So, i'm looking for a way to "check" the network before Socket.Connect even after boot up ...
Thanks anyway, regards
Cédric
Edit:
More info
http://netmf.codeple...m/workitem/1181
http://www.dotnetsol...word-of-warning
Didn't work with 4.1 neither 4.2 (Flashed for this bug)
I still have an IP address in memory even unplugged (DHCP trick)
#7
Posted 29 October 2012 - 05:14 PM
Hi,
I know that i'm digging an old thread but I have the similar question and I must manually set the IP address (so no DHCP).
Is there any way to do it ?
Thanks.
Cédric
Hi Cédric:
var interfaces = Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces(); foreach (var networkInterface in interfaces) { Debug.Print(networkInterface.IsDhcpEnabled ? "Dhcp Enabled" : "Static Ip"); Debug.Print(networkInterface.IPAddress); if (networkInterface.IsDhcpEnabled) { networkInterface.EnableStaticIP("192.168.0.9", "255.255.255.0", "192.168.0.1"); } }
This prints out whether you're already Dhcp Enabled or Static, and if Dhcp it sets to static.
You'd probably want to be a little cleverer around releasing leases if you want to be friendly to your dhcp server, but otherwise the above works.
Regards
Andy
#8
Posted 29 October 2012 - 05:59 PM
#9
Posted 30 October 2012 - 12:45 AM
#10
Posted 08 November 2012 - 10:10 AM
#11
Posted 09 November 2012 - 01:57 PM
ntools
TCP Listener (Beta) · FTP Server (Alpha)
Netduino Plus Go Module · Xml Parser
http://ntools.codeplex.com/
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users