I'm writing an application that will be used in a mobile environment where network connectivity will be up/down regularly. How do I check to see that a specific network is available?
+3
A:
Try NetworkInterface.GetIsNetworkAvailable
:
Indicates whether any network connection is available.
A network connection is considered to be available if any network interface is marked "up" and is not a loopback or tunnel interface.
Andrew Hare
2009-12-22 15:56:51
+1
A:
To see if any network is available you can use the VB.NET My namespace:
My.Computer.Network.IsAvailable
which I would guess is an abstraction of the NetworkInterface
property in Andrew's answer. To see if you can use an available network to get to a specific server, you can use
My.Computer.Network.Ping(host name or IP address, or a System.Uri)
PhilPursglove
2009-12-22 16:55:19