C#

[C#]인터넷 연결 여부 예제

선영아 사랑해 2016. 10. 28. 14:51


using System.Runtime.InteropServices;


[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState(out int Description, int ReservedValue);
public static bool IsConnectedToInternet()
{
    int Desc;
    return InternetGetConnectedState(out Desc, 0);
}


반환값이 True면 해당 컴퓨터는 인터넷 연결된 겁니다.