Skip to content

Instantly share code, notes, and snippets.

View tpund's full-sized avatar

Tanstaafl74 tpund

  • Adaptive Solutions
  • Missouri
View GitHub Profile
@tpund
tpund / IsVpnConnected.cs
Created May 3, 2017 18:17
Check VPN connection C#
if (NetworkInterface.GetIsNetworkAvailable())
{
NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface Interface in interfaces)
{
if (Interface.OperationalStatus == OperationalStatus.Up)
{
if ((Interface.NetworkInterfaceType == NetworkInterfaceType.Ppp) && (Interface.NetworkInterfaceType != NetworkInterfaceType.Loopback))
{
IPv4InterfaceStatistics statistics = Interface.GetIPv4Statistics();