Skip to content

Instantly share code, notes, and snippets.

@vkbandi
Created September 16, 2015 20:22
Show Gist options
  • Save vkbandi/3b8d654cfec70513f861 to your computer and use it in GitHub Desktop.
Save vkbandi/3b8d654cfec70513f861 to your computer and use it in GitHub Desktop.
C# class to check for internet Connection
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace Coderbuddy
{
public class CheckInternetConnection
{
[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState(out int Description, int ReservedValue);
public bool IsInternetConnectionAvailable()
{
int Desc;
return InternetGetConnectedState(out Desc, 0);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment