Created
September 16, 2015 20:22
-
-
Save vkbandi/3b8d654cfec70513f861 to your computer and use it in GitHub Desktop.
C# class to check for internet Connection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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