C# - Check internet connection
User Rating: / 8
PoorBest 
Written by Loginworks Team   
Wednesday, 18 August 2010 06:56
using System ;
using System.Runtime ;
using System.Runtime.InteropServices ;

public class InternetClass
{
//Creating the extern function for checking internet connection.
[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState(out int Description, int ReservedValue) ;

//Creating a function that uses the API function to check internet connection.
public static bool IsConnectedToInternet( )
{
int Desc ;
return InternetGetConnectedState(out Desc, 0) ;
}
}
C# - Check internet connection
Last Updated on Tuesday, 27 September 2011 12:31